(original) (raw)
changeset: 104133:e53984b87cf0 branch: 3.6 parent: 104131:d0b509777443 user: Berker Peksag berker.peksag@gmail.com date: Wed Sep 28 17:38:53 2016 +0300 files: Lib/test/test_compileall.py description: Issue #27322: Set sys.path to a temp dir in test_compile_path diff -r d0b509777443 -r e53984b87cf0 Lib/test/test_compileall.py --- a/Lib/test/test_compileall.py Wed Sep 28 17:29:12 2016 +0300 +++ b/Lib/test/test_compileall.py Wed Sep 28 17:38:53 2016 +0300 @@ -103,19 +103,8 @@ force=False, quiet=2)) def test_compile_path(self): - # Exclude Lib/test/ which contains invalid Python files like - # Lib/test/badsyntax_pep3120.py - testdir = os.path.realpath(os.path.dirname(__file__)) - if testdir in sys.path: - self.addCleanup(setattr, sys, 'path', sys.path) - - sys.path = list(sys.path) - try: - sys.path.remove(testdir) - except ValueError: - pass - - self.assertTrue(compileall.compile_path(quiet=2)) + with test.test_importlib.util.import_state(path=[self.directory]): + self.assertTrue(compileall.compile_path(quiet=2)) with test.test_importlib.util.import_state(path=[self.directory]): self.add_bad_source_file() /berker.peksag@gmail.com