aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_msvc9compiler.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2014-09-26 18:38:39 -0400
committerJason R. Coombs <jaraco@jaraco.com>2014-09-26 18:38:39 -0400
commit57ff99e246a2fdb3d59e7aa977fe3b1e00924c99 (patch)
tree723155d493d20ca41027017181354aa95473b14b /setuptools/tests/test_msvc9compiler.py
parente87ba1aa48bb891bb29704d321754623956fef44 (diff)
downloadexternal_python_setuptools-57ff99e246a2fdb3d59e7aa977fe3b1e00924c99.tar.gz
external_python_setuptools-57ff99e246a2fdb3d59e7aa977fe3b1e00924c99.tar.bz2
external_python_setuptools-57ff99e246a2fdb3d59e7aa977fe3b1e00924c99.zip
Grab winreg module from distutils.msvc9compiler
Diffstat (limited to 'setuptools/tests/test_msvc9compiler.py')
-rw-r--r--setuptools/tests/test_msvc9compiler.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py
index 74b5220b..8f71c3d5 100644
--- a/setuptools/tests/test_msvc9compiler.py
+++ b/setuptools/tests/test_msvc9compiler.py
@@ -12,11 +12,6 @@ import tempfile
import unittest
import distutils.errors
-try:
- from winreg import HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE
-except ImportError:
- from _winreg import HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE
-
import distutils.msvc9compiler
# importing only setuptools should apply the patch
@@ -36,9 +31,12 @@ class MockReg:
self.original_read_keys = distutils.msvc9compiler.Reg.read_keys
self.original_read_values = distutils.msvc9compiler.Reg.read_values
+ _winreg = getattr(distutils.msvc9compiler, '_winreg', None)
+ winreg = getattr(distutils.msvc9compiler, 'winreg', _winreg)
+
hives = {
- HKEY_CURRENT_USER: self.hkcu,
- HKEY_LOCAL_MACHINE: self.hklm,
+ winreg.HKEY_CURRENT_USER: self.hkcu,
+ winreg.HKEY_LOCAL_MACHINE: self.hklm,
}
def read_keys(cls, base, key):