summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_import
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2022-06-10 21:56:26 (GMT)
committerGitHub <noreply@github.com>2022-06-10 21:56:26 (GMT)
commit09243b898a13f3f61e275c1031143d1225e70916 (patch)
treefe8d33df19d464585d2f4391c262b225834f3f28 /Lib/test/test_import
parentcf730b595eea0460a7305205f7dfb6ecf0346351 (diff)
downloadcpython-09243b898a13f3f61e275c1031143d1225e70916.zip
cpython-09243b898a13f3f61e275c1031143d1225e70916.tar.gz
cpython-09243b898a13f3f61e275c1031143d1225e70916.tar.bz2
gh-93461: Invalidate sys.path_importer_cache entries with relative paths (GH-93653)
Diffstat (limited to 'Lib/test/test_import')
-rw-r--r--Lib/test/test_import/__init__.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/test/test_import/__init__.py b/Lib/test/test_import/__init__.py
index be2e91d..8357586 100644
--- a/Lib/test/test_import/__init__.py
+++ b/Lib/test/test_import/__init__.py
@@ -927,7 +927,7 @@ class PycacheTests(unittest.TestCase):
m = __import__(TESTFN)
try:
self.assertEqual(m.__file__,
- os.path.join(os.getcwd(), os.curdir, os.path.relpath(pyc_file)))
+ os.path.join(os.getcwd(), os.path.relpath(pyc_file)))
finally:
os.remove(pyc_file)
@@ -935,7 +935,7 @@ class PycacheTests(unittest.TestCase):
# Modules now also have an __cached__ that points to the pyc file.
m = __import__(TESTFN)
pyc_file = importlib.util.cache_from_source(TESTFN + '.py')
- self.assertEqual(m.__cached__, os.path.join(os.getcwd(), os.curdir, pyc_file))
+ self.assertEqual(m.__cached__, os.path.join(os.getcwd(), pyc_file))
@skip_if_dont_write_bytecode
def test___cached___legacy_pyc(self):
@@ -951,7 +951,7 @@ class PycacheTests(unittest.TestCase):
importlib.invalidate_caches()
m = __import__(TESTFN)
self.assertEqual(m.__cached__,
- os.path.join(os.getcwd(), os.curdir, os.path.relpath(pyc_file)))
+ os.path.join(os.getcwd(), os.path.relpath(pyc_file)))
@skip_if_dont_write_bytecode
def test_package___cached__(self):
@@ -971,10 +971,10 @@ class PycacheTests(unittest.TestCase):
m = __import__('pep3147.foo')
init_pyc = importlib.util.cache_from_source(
os.path.join('pep3147', '__init__.py'))
- self.assertEqual(m.__cached__, os.path.join(os.getcwd(), os.curdir, init_pyc))
+ self.assertEqual(m.__cached__, os.path.join(os.getcwd(), init_pyc))
foo_pyc = importlib.util.cache_from_source(os.path.join('pep3147', 'foo.py'))
self.assertEqual(sys.modules['pep3147.foo'].__cached__,
- os.path.join(os.getcwd(), os.curdir, foo_pyc))
+ os.path.join(os.getcwd(), foo_pyc))
def test_package___cached___from_pyc(self):
# Like test___cached__ but ensuring __cached__ when imported from a
@@ -998,10 +998,10 @@ class PycacheTests(unittest.TestCase):
m = __import__('pep3147.foo')
init_pyc = importlib.util.cache_from_source(
os.path.join('pep3147', '__init__.py'))
- self.assertEqual(m.__cached__, os.path.join(os.getcwd(), os.curdir, init_pyc))
+ self.assertEqual(m.__cached__, os.path.join(os.getcwd(), init_pyc))
foo_pyc = importlib.util.cache_from_source(os.path.join('pep3147', 'foo.py'))
self.assertEqual(sys.modules['pep3147.foo'].__cached__,
- os.path.join(os.getcwd(), os.curdir, foo_pyc))
+ os.path.join(os.getcwd(), foo_pyc))
def test_recompute_pyc_same_second(self):
# Even when the source file doesn't change timestamp, a change in