mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 21:21:15 -07:00
Update importlib-resources==5.4.0
This commit is contained in:
parent
c79c48fcca
commit
563f697563
12 changed files with 167 additions and 125 deletions
|
@ -8,7 +8,7 @@ from . import util
|
|||
|
||||
class CommonTests(util.CommonTests, unittest.TestCase):
|
||||
def execute(self, package, path):
|
||||
with resources.path(package, path):
|
||||
with resources.as_file(resources.files(package).joinpath(path)):
|
||||
pass
|
||||
|
||||
|
||||
|
@ -17,7 +17,8 @@ class PathTests:
|
|||
# Path should be readable.
|
||||
# Test also implicitly verifies the returned object is a pathlib.Path
|
||||
# instance.
|
||||
with resources.path(self.data, 'utf-8.file') as path:
|
||||
target = resources.files(self.data) / 'utf-8.file'
|
||||
with resources.as_file(target) as path:
|
||||
self.assertTrue(path.name.endswith("utf-8.file"), repr(path))
|
||||
# pathlib.Path.read_text() was introduced in Python 3.5.
|
||||
with path.open('r', encoding='utf-8') as file:
|
||||
|
@ -34,7 +35,8 @@ class PathDiskTests(PathTests, unittest.TestCase):
|
|||
file-system-backed resources do not get the tempdir
|
||||
treatment.
|
||||
"""
|
||||
with resources.path(self.data, 'utf-8.file') as path:
|
||||
target = resources.files(self.data) / 'utf-8.file'
|
||||
with resources.as_file(target) as path:
|
||||
assert 'data' in str(path)
|
||||
|
||||
|
||||
|
@ -53,7 +55,8 @@ 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
|
||||
# file system is removed inside the `with` stanza.
|
||||
with resources.path(self.data, 'utf-8.file') as path:
|
||||
target = resources.files(self.data) / 'utf-8.file'
|
||||
with resources.as_file(target) as path:
|
||||
path.unlink()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue