aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_msvc9compiler.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2014-12-31 14:45:33 -0500
committerJason R. Coombs <jaraco@jaraco.com>2014-12-31 14:45:33 -0500
commit05dfef7ed54dba0f858115be441febc94b79010a (patch)
tree1a30b34ddd5e328d5eb1b35094cb08fd5bd06638 /setuptools/tests/test_msvc9compiler.py
parent86a0dc8419a3649389bd7d58a1f7c79bae0baad6 (diff)
downloadexternal_python_setuptools-05dfef7ed54dba0f858115be441febc94b79010a.tar.gz
external_python_setuptools-05dfef7ed54dba0f858115be441febc94b79010a.tar.bz2
external_python_setuptools-05dfef7ed54dba0f858115be441febc94b79010a.zip
Rewrite assert
Diffstat (limited to 'setuptools/tests/test_msvc9compiler.py')
-rw-r--r--setuptools/tests/test_msvc9compiler.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py
index 970f7679..8567aa58 100644
--- a/setuptools/tests/test_msvc9compiler.py
+++ b/setuptools/tests/test_msvc9compiler.py
@@ -7,12 +7,13 @@ finds the Visual C++ for Python package.
import os
import shutil
-import sys
import tempfile
import unittest
import distutils.errors
import contextlib
+import pytest
+
# importing only setuptools should apply the patch
__import__('setuptools')
@@ -93,11 +94,8 @@ class TestMSVC9Compiler(unittest.TestCase):
# skip
return
- self.assertEqual(
- "setuptools.msvc9_support",
- distutils.msvc9compiler.find_vcvarsall.__module__,
- "find_vcvarsall was not patched"
- )
+ mod_name = distutils.msvc9compiler.find_vcvarsall.__module__
+ assert mod_name == "setuptools.msvc9_support", "find_vcvarsall unpatched"
find_vcvarsall = distutils.msvc9compiler.find_vcvarsall
query_vcvarsall = distutils.msvc9compiler.query_vcvarsall
@@ -108,12 +106,10 @@ class TestMSVC9Compiler(unittest.TestCase):
with MockReg():
self.assertIsNone(find_vcvarsall(9.0))
- try:
+ expected = distutils.errors.DistutilsPlatformError
+ with pytest.raises(expected) as exc:
query_vcvarsall(9.0)
- self.fail('Expected DistutilsPlatformError from query_vcvarsall()')
- except distutils.errors.DistutilsPlatformError:
- exc_message = str(sys.exc_info()[1])
- self.assertIn('aka.ms/vcpython27', exc_message)
+ assert 'aka.ms/vcpython27' in str(exc)
key_32 = r'software\microsoft\devdiv\vcforpython\9.0\installdir'
key_64 = r'software\wow6432node\microsoft\devdiv\vcforpython\9.0\installdir'