Skip to content

Commit 46a37bb

Browse files
mgornyarthurzam
authored andcommitted
tests: Wrap partial() in staticmethod(), in attributes for py3.14
Wrap `partial()` uses in class attributes in `staticmethod()`, as required for them to work correctly in Python 3.14. > functools.partial is now a method descriptor. Wrap it in staticmethod() > if you want to preserve the old behavior. (https://docs.python.org/3.14/whatsnew/3.14.html#changes-in-the-python-api) Signed-off-by: Michał Górny <mgorny@gentoo.org> Part-of: #738 Closes: #738 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
1 parent 1309009 commit 46a37bb

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

tests/scripts/test_pkgcheck.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
def test_script_run(capsys):
1111
"""Test regular code path for running scripts."""
12-
script = partial(run, project)
12+
script = staticmethod(partial(run, project))
1313

1414
with patch(f"{project}.scripts.import_module") as import_module:
1515
import_module.side_effect = ImportError("baz module doesn't exist")
@@ -40,7 +40,7 @@ def test_script_run(capsys):
4040

4141

4242
class TestPkgcheck:
43-
script = partial(run, project)
43+
script = staticmethod(partial(run, project))
4444

4545
def test_version(self, capsys):
4646
with patch("sys.argv", [project, "--version"]):

tests/scripts/test_pkgcheck_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
class TestPkgcheckCache:
11-
script = partial(run, project)
11+
script = staticmethod(partial(run, project))
1212

1313
@pytest.fixture(autouse=True)
1414
def _setup(self, testconfig, tmp_path):

tests/scripts/test_pkgcheck_ci.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
class TestPkgcheckCi:
12-
script = partial(run, "pkgcheck")
12+
script = staticmethod(partial(run, "pkgcheck"))
1313

1414
@pytest.fixture(autouse=True)
1515
def _setup(self, testconfig, tmp_path):

tests/scripts/test_pkgcheck_show.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
class TestPkgcheckShow:
13-
script = partial(run, project)
13+
script = staticmethod(partial(run, project))
1414

1515
@pytest.fixture(autouse=True)
1616
def _setup(self, testconfig):

0 commit comments

Comments
 (0)