Debian Codegraph @

debian/patches/0003-Fix-deprecated-py.path.local-usage.patch

raw
1 From: =?utf-8?q?Timo_R=C3=B6hling?= <[email protected]>
2 Date: Mon, 22 Dec 2025 10:49:00 +0100
3 Subject: Fix deprecated py.path.local usage
4
5 ---
6 html5lib/tests/conftest.py | 33 +++++++++++++++------------------
7 1 file changed, 15 insertions(+), 18 deletions(-)
8
9 diff --git a/html5lib/tests/conftest.py b/html5lib/tests/conftest.py
10 index de9b157..de76e98 100644
11 --- a/html5lib/tests/conftest.py
12 +++ b/html5lib/tests/conftest.py
13 @@ -8,12 +8,13 @@ from .tree_construction import TreeConstructionFile
14 from .tokenizer import TokenizerFile
15 from .sanitizer import SanitizerFile
16
17 -_dir = os.path.abspath(os.path.dirname(__file__))
18 -_root = os.path.join(_dir, "..", "..")
19 -_testdata = os.path.join(_dir, "testdata")
20 -_tree_construction = os.path.join(_testdata, "tree-construction")
21 -_tokenizer = os.path.join(_testdata, "tokenizer")
22 -_sanitizer_testdata = os.path.join(_dir, "sanitizer-testdata")
23 +from pathlib import Path
24 +_dir = Path(__file__).absolute().parent
25 +_root = _dir.parent.parent
26 +_testdata = _dir / "testdata"
27 +_tree_construction = _testdata / "tree-construction"
28 +_tokenizer = _testdata / "tokenizer"
29 +_sanitizer_testdata = _dir / "sanitizer-testdata"
30
31
32 def fail_if_missing_pytest_expect():
33 @@ -89,22 +90,18 @@ def pytest_configure(config):
34 pytest.exit("\n".join(msgs))
35
36
37 -def pytest_collect_file(path, parent):
38 - dir = os.path.abspath(path.dirname)
39 - dir_and_parents = set()
40 - while dir not in dir_and_parents:
41 - dir_and_parents.add(dir)
42 - dir = os.path.dirname(dir)
43 +def pytest_collect_file(file_path, parent):
44 + dir_and_parents = file_path.absolute().parents
45
46 if _tree_construction in dir_and_parents:
47 - if path.ext == ".dat":
48 - return TreeConstructionFile.from_parent(parent, fspath=path)
49 + if file_path.suffix == ".dat":
50 + return TreeConstructionFile.from_parent(parent, path=file_path)
51 elif _tokenizer in dir_and_parents:
52 - if path.ext == ".test":
53 - return TokenizerFile.from_parent(parent, fspath=path)
54 + if file_path.suffix == ".test":
55 + return TokenizerFile.from_parent(parent, path=file_path)
56 elif _sanitizer_testdata in dir_and_parents:
57 - if path.ext == ".dat":
58 - return SanitizerFile.from_parent(parent, fspath=path)
59 + if file_path.suffix == ".dat":
60 + return SanitizerFile.from_parent(parent, path=file_path)
61
62
63 # Tiny wrapper to allow .from_parent constructors on older pytest for PY27