]> granicus.if.org Git - python/commitdiff
test_distutils: use EnvironGuard (#1433)
authorVictor Stinner <victor.stinner@gmail.com>
Wed, 3 May 2017 15:28:10 +0000 (17:28 +0200)
committerGitHub <noreply@github.com>
Wed, 3 May 2017 15:28:10 +0000 (17:28 +0200)
Use EnvironGuard on InstallTestCase and UtilTestCase.

Backport fixes from master to prevent the following warning:

Warning -- os.environ was modified by test_distutils

Lib/distutils/tests/test_install.py
Lib/distutils/tests/test_util.py

index c3492b8c9042212a61294547d90fa6a6970b645f..397e2a7d4bbac9f003f5ff9051f4856fb6d9be02 100644 (file)
@@ -26,6 +26,7 @@ def _make_ext_name(modname):
 
 
 class InstallTestCase(support.TempdirManager,
+                      support.EnvironGuard,
                       support.LoggingSilencer,
                       unittest.TestCase):
 
index 2d7b101d16d2e8630b1884548255cea8171ceb9d..7898e07b2517145f1c5c21fdd8d258ef277c8859 100644 (file)
@@ -4,10 +4,11 @@ import unittest
 from test.test_support import run_unittest
 
 from distutils.errors import DistutilsByteCompileError
+from distutils.tests import support
 from distutils.util import byte_compile, grok_environment_error
 
 
-class UtilTestCase(unittest.TestCase):
+class UtilTestCase(support.EnvironGuard, unittest.TestCase):
 
     def test_dont_write_bytecode(self):
         # makes sure byte_compile raise a DistutilsError