mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Changed distutils tests to avoid environment alteration
This commit is contained in:
parent
11abfe640f
commit
2b06d42db5
13 changed files with 67 additions and 34 deletions
|
@ -8,7 +8,7 @@ import sys
|
|||
import test.test_support
|
||||
from test.test_support import captured_stdout
|
||||
import unittest
|
||||
|
||||
from distutils.tests import support
|
||||
|
||||
# setup script that uses __file__
|
||||
setup_using___file__ = """\
|
||||
|
@ -29,17 +29,20 @@ setup()
|
|||
"""
|
||||
|
||||
|
||||
class CoreTestCase(unittest.TestCase):
|
||||
class CoreTestCase(support.EnvironGuard, unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(CoreTestCase, self).setUp()
|
||||
self.old_stdout = sys.stdout
|
||||
self.cleanup_testfn()
|
||||
self.old_argv = sys.argv[:]
|
||||
self.old_argv = sys.argv, sys.argv[:]
|
||||
|
||||
def tearDown(self):
|
||||
sys.stdout = self.old_stdout
|
||||
self.cleanup_testfn()
|
||||
sys.argv = self.old_argv[:]
|
||||
sys.argv = self.old_argv[0]
|
||||
sys.argv[:] = self.old_argv[1]
|
||||
super(CoreTestCase, self).tearDown()
|
||||
|
||||
def cleanup_testfn(self):
|
||||
path = test.test_support.TESTFN
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue