Commit 04cf5040 authored by Jason R. Coombs's avatar Jason R. Coombs

Use pytest importorskip for skip logic

parent 05dfef7e
...@@ -17,6 +17,8 @@ import pytest ...@@ -17,6 +17,8 @@ import pytest
# importing only setuptools should apply the patch # importing only setuptools should apply the patch
__import__('setuptools') __import__('setuptools')
pytest.importorskip("distutils.msvc9compiler")
class MockReg: class MockReg:
"""Mock for distutils.msvc9compiler.Reg. We patch it """Mock for distutils.msvc9compiler.Reg. We patch it
with an instance of this class that mocks out the with an instance of this class that mocks out the
...@@ -90,10 +92,6 @@ def patch_env(**replacements): ...@@ -90,10 +92,6 @@ def patch_env(**replacements):
class TestMSVC9Compiler(unittest.TestCase): class TestMSVC9Compiler(unittest.TestCase):
def test_find_vcvarsall_patch(self): def test_find_vcvarsall_patch(self):
if not hasattr(distutils, 'msvc9compiler'):
# skip
return
mod_name = distutils.msvc9compiler.find_vcvarsall.__module__ mod_name = distutils.msvc9compiler.find_vcvarsall.__module__
assert mod_name == "setuptools.msvc9_support", "find_vcvarsall unpatched" assert mod_name == "setuptools.msvc9_support", "find_vcvarsall unpatched"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment