diff options
| author | Steve Dower <steve.dower@microsoft.com> | 2017-09-07 11:49:23 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-09-07 11:49:23 -0700 |
| commit | 05f01d85257d0f3409c7335aaf0bf6a6da7eecb7 (patch) | |
| tree | 32f5e8671e6f384e1ee8b3d38c45495778f45f03 /Lib/distutils/tests | |
| parent | a853a8ba7850381d49b284295dd6f0dc491dbe44 (diff) | |
| download | cpython-git-05f01d85257d0f3409c7335aaf0bf6a6da7eecb7.tar.gz | |
bpo-30389 Adds detection of VS 2017 to distutils._msvccompiler (#1632)
Diffstat (limited to 'Lib/distutils/tests')
| -rw-r--r-- | Lib/distutils/tests/test_msvccompiler.py | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/Lib/distutils/tests/test_msvccompiler.py b/Lib/distutils/tests/test_msvccompiler.py index 4dc24886c8..70a9c93a4e 100644 --- a/Lib/distutils/tests/test_msvccompiler.py +++ b/Lib/distutils/tests/test_msvccompiler.py @@ -76,12 +76,12 @@ class msvccompilerTestCase(support.TempdirManager, compiler = _msvccompiler.MSVCCompiler() compiler.initialize() dll = compiler._vcruntime_redist - self.assertTrue(os.path.isfile(dll)) + self.assertTrue(os.path.isfile(dll), dll or "<None>") compiler._copy_vcruntime(tempdir) self.assertFalse(os.path.isfile(os.path.join( - tempdir, os.path.basename(dll)))) + tempdir, os.path.basename(dll))), dll or "<None>") def test_get_vc_env_unicode(self): import distutils._msvccompiler as _msvccompiler @@ -101,6 +101,30 @@ class msvccompilerTestCase(support.TempdirManager, if old_distutils_use_sdk: os.environ['DISTUTILS_USE_SDK'] = old_distutils_use_sdk + def test_get_vc2017(self): + import distutils._msvccompiler as _msvccompiler + + # This function cannot be mocked, so pass it if we find VS 2017 + # and mark it skipped if we do not. + version, path = _msvccompiler._find_vc2017() + if version: + self.assertGreaterEqual(version, 15) + self.assertTrue(os.path.isdir(path)) + else: + raise unittest.SkipTest("VS 2017 is not installed") + + def test_get_vc2015(self): + import distutils._msvccompiler as _msvccompiler + + # This function cannot be mocked, so pass it if we find VS 2015 + # and mark it skipped if we do not. + version, path = _msvccompiler._find_vc2015() + if version: + self.assertGreaterEqual(version, 14) + self.assertTrue(os.path.isdir(path)) + else: + raise unittest.SkipTest("VS 2015 is not installed") + def test_suite(): return unittest.makeSuite(msvccompilerTestCase) |
