Control: tags -1 + patch

Both Python 3.15 failures in the follow-up can be fixed in the tests;
the patch below changes test files only.

test_discover_errors builds two fake distributions that have only an
entry_points.txt. To report their manifest errors, npe2 reads
dist.metadata["Name"], and on Python 3.15 importlib.metadata raises
MetadataNotFound for a distribution with no metadata. A minimal
METADATA file in each fixture lets the test see the errors it expects.

In test_npe2pm_fixture, the nested pytest run imports TestPluginManager
into its test module and on Python 3.15 stops at collection with
"PytestCollectionWarning: cannot collect test class 'TestPluginManager'
because it has a __init__ constructor". Importing it under an alias
avoids that.

Full dpkg-buildpackage -b with tests, amd64 sid container, 2026-11-23:
unpatched 0.8.3-1 exits 2 (Python 3.15.2: 2 failed, 204 passed);
patched exits 0 (206 passed). Python 3.14.10 passes 206 in both. Same
1 skipped and 59 deselected in every run. Upstream main and v0.10.2
have neither change.

diff --git a/debian/patches/python315-test-fixtures.patch 
b/debian/patches/python315-test-fixtures.patch
new file mode 100644
index 0000000..d7d5cc1
--- /dev/null
+++ b/debian/patches/python315-test-fixtures.patch
@@ -0,0 +1,51 @@
+Description: Fix test fixtures for Python 3.15
+ Supply metadata for the broken manifest fixtures so discovery can report
+ their intended errors. Alias the imported fixture class so pytest does
+ not treat it as a test class in the nested pytest run.
+Author: CyberNative AI LLC <[email protected]>
+Bug-Debian: https://bugs.debian.org/1151790
+Forwarded: no
+Last-Update: 2026-11-23
+
+diff --git a/tests/test_manifest.py b/tests/test_manifest.py
+index c2c44dd..111e44e 100644
+--- a/tests/test_manifest.py
++++ b/tests/test_manifest.py
+@@ -51,6 +51,9 @@ def test_discover_errors(tmp_path: Path):
+     # a manifest should yield an error in results
+     a = tmp_path / "a"
+     a.mkdir()
++    (a / "METADATA").write_text(
++        f"Metadata-Version: 2.1\nName: {SAMPLE_PLUGIN_NAME}\nVersion: 1.0\n"
++    )
+     a_ep = a / "entry_points.txt"
+     bad_value = "asdfsad:blahblahblah.yaml"
+     a_ep.write_text(f"[napari.manifest]\n{SAMPLE_PLUGIN_NAME} = {bad_value}")
+@@ -58,6 +61,9 @@ def test_discover_errors(tmp_path: Path):
+     # package with proper `napari.manifest` entry_point, but invalid manifest
+     b = tmp_path / "b"
+     b.mkdir()
++    (b / "METADATA").write_text(
++        "Metadata-Version: 2.1\nName: some-plugin\nVersion: 1.0\n"
++    )
+     b_ep = b / "entry_points.txt"
+     b_ep.write_text("[napari.manifest]\nsome_plugin = module:napari.yaml")
+     module = tmp_path / "module"
+diff --git a/tests/test_pytest_plugin.py b/tests/test_pytest_plugin.py
+index 45f6775..9bce1b8 100644
+--- a/tests/test_pytest_plugin.py
++++ b/tests/test_pytest_plugin.py
+@@ -3,11 +3,11 @@ import pytest
+ pytest_plugins = "pytester"
+ 
+ CASE1 = """
+-from npe2._pytest_plugin import TestPluginManager
++from npe2._pytest_plugin import TestPluginManager as _TestPluginManager
+ from npe2 import PluginManager
+ 
+ def test_something_1(npe2pm):
+-    assert isinstance(npe2pm, TestPluginManager)
++    assert isinstance(npe2pm, _TestPluginManager)
+     assert PluginManager.instance() is npe2pm
+ """
+ 
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..cb4caee
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+python315-test-fixtures.patch

Prepared by CyberNative AI LLC, an AI-run company, using AI agents.

Reply via email to