summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_cmd_line_script.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2012-04-26 00:54:04 (GMT)
committerBrett Cannon <brett@python.org>2012-04-26 00:54:04 (GMT)
commite0d88a173c5ccc346b8d7c6e805f0e49b4ea92f7 (patch)
tree476528c79622c96645adf554536eeeba0c4ee0d8 /Lib/test/test_cmd_line_script.py
parent8f79dd5d7cc3eb19d568f8e95f04ee33f1177d92 (diff)
downloadcpython-e0d88a173c5ccc346b8d7c6e805f0e49b4ea92f7.zip
cpython-e0d88a173c5ccc346b8d7c6e805f0e49b4ea92f7.tar.gz
cpython-e0d88a173c5ccc346b8d7c6e805f0e49b4ea92f7.tar.bz2
Issue #14605: Make explicit the entries on sys.path_hooks that used to
be implicit. Added a warning for when sys.path_hooks is found to be empty. Also changed the meaning of None in sys.path_importer_cache to represent trying sys.path_hooks again (an interpretation of previous semantics). Also added a warning for when None was found. The long-term goal is for None in sys.path_importer_cache to represent the same as imp.NullImporter: no finder found for that sys.path entry.
Diffstat (limited to 'Lib/test/test_cmd_line_script.py')
-rw-r--r--Lib/test/test_cmd_line_script.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py
index 77af347..155aafc 100644
--- a/Lib/test/test_cmd_line_script.py
+++ b/Lib/test/test_cmd_line_script.py
@@ -1,5 +1,6 @@
# tests command line execution of scripts
+import importlib
import unittest
import sys
import os
@@ -49,12 +50,16 @@ print('cwd==%a' % os.getcwd())
"""
def _make_test_script(script_dir, script_basename, source=test_source):
- return make_script(script_dir, script_basename, source)
+ to_return = make_script(script_dir, script_basename, source)
+ importlib.invalidate_caches()
+ return to_return
def _make_test_zip_pkg(zip_dir, zip_basename, pkg_name, script_basename,
source=test_source, depth=1):
- return make_zip_pkg(zip_dir, zip_basename, pkg_name, script_basename,
- source, depth)
+ to_return = make_zip_pkg(zip_dir, zip_basename, pkg_name, script_basename,
+ source, depth)
+ importlib.invalidate_caches()
+ return to_return
# There's no easy way to pass the script directory in to get
# -m to work (avoiding that is the whole point of making
@@ -72,7 +77,9 @@ def _make_launch_script(script_dir, script_basename, module_name, path=None):
else:
path = repr(path)
source = launch_source % (path, module_name)
- return make_script(script_dir, script_basename, source)
+ to_return = make_script(script_dir, script_basename, source)
+ importlib.invalidate_caches()
+ return to_return
class CmdLineTest(unittest.TestCase):
def _check_output(self, script_name, exit_code, data,