Skip to content

Commit 21b1db6

Browse files
committed
tests: added explicit filter to tarfile.extractall calls
triggered by this warning: ``` DeprecationWarning: Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata. Use the filter argument to control this behavior. ```
1 parent 0010a13 commit 21b1db6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/examples/nginx/entry-point_test.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def _rebuild_sources():
5151
with tarfile.open(_source.as_posix(), "r") as _reader:
5252
_directory = _temporary / f"sources/{next(_index_generator)}"
5353
os.makedirs(_directory, exist_ok = False)
54-
_reader.extractall(path = _directory)
54+
_reader.extractall(path = _directory, filter = "tar")
5555
assert 2 < len(os.listdir(_directory))
5656
yield _directory
5757
_path = _temporary / f"sources/{next(_index_generator)}"
@@ -135,12 +135,14 @@ def _make_common_context(path: pathlib.Path):
135135
_archive_path = f"{path.as_posix()}.tar"
136136
yield _archive_path
137137
os.makedirs(path.as_posix(), exist_ok = False)
138-
with tarfile.open(_archive_path, "r|") as _reader: _reader.extractall(path = path.as_posix())
138+
with tarfile.open(_archive_path, "r|") as _reader: _reader.extractall(
139+
path = path.as_posix(), filter = "tar"
140+
)
139141
_script_directory_path = os.path.join(path, _script_example_base_name)
140142
_script_archive_path = f"{_script_directory_path}.tar"
141143
os.makedirs(_script_directory_path, exist_ok = False)
142144
with tarfile.open(_script_archive_path, "r|") as _reader: _reader.extractall(
143-
path = _script_directory_path
145+
path = _script_directory_path, filter = "tar"
144146
)
145147
os.remove(_script_archive_path)
146148
if not (0 < key): return

0 commit comments

Comments
 (0)