diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2021-03-04 18:43:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-04 18:43:00 (GMT) |
commit | 67148254146948041a77d8a2989f41b88cdb2f99 (patch) | |
tree | 036bcb818e80090b34f0c59f57f8b6946b52b21d /Lib/test/test_importlib/test_path.py | |
parent | fbf75b9997e280b1220755d0a17dbed71240d42e (diff) | |
download | cpython-67148254146948041a77d8a2989f41b88cdb2f99.zip cpython-67148254146948041a77d8a2989f41b88cdb2f99.tar.gz cpython-67148254146948041a77d8a2989f41b88cdb2f99.tar.bz2 |
bpo-42129: Add support for resources in namespaces (GH-24670)
* Unify behavior in ResourceReaderDefaultsTests and align with the behavior found in importlib_resources.
* Equip NamespaceLoader with a NamespaceReader.
* Apply changes from importlib_resources 5.0.4
Diffstat (limited to 'Lib/test/test_importlib/test_path.py')
-rw-r--r-- | Lib/test/test_importlib/test_path.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_importlib/test_path.py b/Lib/test/test_importlib/test_path.py index abf8086..2110770 100644 --- a/Lib/test/test_importlib/test_path.py +++ b/Lib/test/test_importlib/test_path.py @@ -1,3 +1,4 @@ +import io import unittest from importlib import resources @@ -37,6 +38,17 @@ class PathDiskTests(PathTests, unittest.TestCase): assert 'data' in str(path) +class PathMemoryTests(PathTests, unittest.TestCase): + def setUp(self): + file = io.BytesIO(b'Hello, UTF-8 world!\n') + self.addCleanup(file.close) + self.data = util.create_package( + file=file, path=FileNotFoundError("package exists only in memory") + ) + self.data.__spec__.origin = None + self.data.__spec__.has_location = False + + class PathZipTests(PathTests, util.ZipSetup, unittest.TestCase): def test_remove_in_context_manager(self): # It is not an error if the file that was temporarily stashed on the |