[3.12] GH-115979: update test_importlib to work under WASI SDK 21 (GH-116754) (GH-116759)

GH-115979: update test_importlib to work under WASI SDK 21 (GH-116754)
(cherry picked from commit 61733a2fb9)

Co-authored-by: Brett Cannon <brett@python.org>
This commit is contained in:
Miss Islington (bot) 2024-03-13 22:31:09 +01:00 committed by GitHub
parent 592c0e26c0
commit 0cc504771f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 44 additions and 27 deletions

View file

@ -502,7 +502,8 @@ class FactoryTests:
self.assertEqual(spec.loader, self.fileloader)
self.assertEqual(spec.origin, self.path)
self.assertIs(spec.loader_state, None)
self.assertEqual(spec.submodule_search_locations, [os.getcwd()])
location = cwd if (cwd := os.getcwd()) != '/' else ''
self.assertEqual(spec.submodule_search_locations, [location])
self.assertEqual(spec.cached, self.cached)
self.assertTrue(spec.has_location)
@ -601,7 +602,8 @@ class FactoryTests:
self.assertEqual(spec.loader, self.fileloader)
self.assertEqual(spec.origin, self.path)
self.assertIs(spec.loader_state, None)
self.assertEqual(spec.submodule_search_locations, [os.getcwd()])
location = cwd if (cwd := os.getcwd()) != '/' else ''
self.assertEqual(spec.submodule_search_locations, [location])
self.assertEqual(spec.cached, self.cached)
self.assertTrue(spec.has_location)
@ -626,7 +628,8 @@ class FactoryTests:
self.assertEqual(spec.loader, self.pkgloader)
self.assertEqual(spec.origin, self.path)
self.assertIs(spec.loader_state, None)
self.assertEqual(spec.submodule_search_locations, [os.getcwd()])
location = cwd if (cwd := os.getcwd()) != '/' else ''
self.assertEqual(spec.submodule_search_locations, [location])
self.assertEqual(spec.cached, self.cached)
self.assertTrue(spec.has_location)