summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib/test_api.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2018-02-03 00:49:25 (GMT)
committerGitHub <noreply@github.com>2018-02-03 00:49:25 (GMT)
commita23d30f64bd9c5655cfae7f359d4279c47f6cab3 (patch)
treed31d8e14daf1cd7f464a2dc001f10c4a0a943265 /Lib/test/test_importlib/test_api.py
parent2b5937ec0ae88cd0b4cc0c8534f21c435ee94662 (diff)
downloadcpython-a23d30f64bd9c5655cfae7f359d4279c47f6cab3.zip
cpython-a23d30f64bd9c5655cfae7f359d4279c47f6cab3.tar.gz
cpython-a23d30f64bd9c5655cfae7f359d4279c47f6cab3.tar.bz2
bpo-32303 - Consistency fixes for namespace loaders (GH-5481) (#5503)
* Make sure ``__spec__.loader`` matches ``__loader__`` for namespace packages. * Make sure ``__spec__.origin` matches ``__file__`` for namespace packages. https://bugs.python.org/issue32303 https://bugs.python.org/issue32305 (cherry picked from commit bbbcf8693b876daae4469765aa62f8924f39a7d2) Co-authored-by: Barry Warsaw <barry@python.org>
Diffstat (limited to 'Lib/test/test_importlib/test_api.py')
-rw-r--r--Lib/test/test_importlib/test_api.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_importlib/test_api.py b/Lib/test/test_importlib/test_api.py
index 50dbfe1..8beb424 100644
--- a/Lib/test/test_importlib/test_api.py
+++ b/Lib/test/test_importlib/test_api.py
@@ -305,6 +305,7 @@ class ReloadTests:
expected = {'__name__': name,
'__package__': name,
'__doc__': None,
+ '__file__': None,
}
os.mkdir(name)
with open(bad_path, 'w') as init_file:
@@ -316,8 +317,9 @@ class ReloadTests:
spec = ns.pop('__spec__')
ns.pop('__builtins__', None) # An implementation detail.
self.assertEqual(spec.name, name)
- self.assertIs(spec.loader, None)
- self.assertIsNot(loader, None)
+ self.assertIsNotNone(spec.loader)
+ self.assertIsNotNone(loader)
+ self.assertEqual(spec.loader, loader)
self.assertEqual(set(path),
set([os.path.dirname(bad_path)]))
with self.assertRaises(AttributeError):