[Python-checkins] cpython (3.6): Issue #27322: Set sys.path to a temp dir in test_compile_path
berker.peksag
python-checkins at python.org
Wed Sep 28 10:37:28 EDT 2016
https://hg.python.org/cpython/rev/e53984b87cf0
changeset: 104133:e53984b87cf0
branch: 3.6
parent: 104131:d0b509777443
user: Berker Peksag <berker.peksag at gmail.com>
date: Wed Sep 28 17:38:53 2016 +0300
summary:
Issue #27322: Set sys.path to a temp dir in test_compile_path
files:
Lib/test/test_compileall.py | 15 ++-------------
1 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/Lib/test/test_compileall.py b/Lib/test/test_compileall.py
--- a/Lib/test/test_compileall.py
+++ b/Lib/test/test_compileall.py
@@ -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()
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list