Public bug reported:
The package's test suite does not currently run, for two independent reasons.
Neither affects users of the installed package, so this is filed separately
from the IndexError crash I am reporting against the relations plugin. It does
mean that the build-time test step has not been testing the package.
1. ./runtests collects Python's standard library tests instead of the
package's
test/ has no __init__.py, so it is not a package, and with the PYTHONPATH that
runtests sets, "import test" finds Python's own stdlib test package first:
$ PYTHONPATH=$PWD python3 -c "import test; print(test.__file__)"
/usr/lib/python3.14/test/__init__.py
The consequence is that "./runtests -v" runs 70 tests, every one of them from
Python's test_support module, and none of the package's at all.
This is not a property of one machine or one release. The directory, including
the test_support module that gets collected, is shipped by the core stdlib
package:
$ dpkg -S /usr/lib/python3.14/test/test_support.py
libpython3.14-stdlib:amd64: /usr/lib/python3.14/test/test_support.py
$ apt-cache show python3.14 | grep ^Depends
Depends: python3.14-minimal (= ...), libpython3.14-stdlib (= ...), ...
libpython3.14-stdlib provides 76 files under test/ and python3.14 depends on
it, so anything able to run the suite necessarily has the colliding package.
The optional libpython3.14-testsuite is NOT installed here and is not
involved. A minimal build chroot is affected too.
What varies between environments is only whether it is noticed. Here the run
reports 12 failures and 4 errors, but those are Python's own stdlib tests
misbehaving under nose2 rather than anything in this package - the same
numbers appear with the package nowhere in sight:
$ cd /tmp && python3 -m nose2 test.test_support
Ran 70 tests in 2.685s
FAILED (failures=12, errors=4, skipped=2)
(nose2 0.16.0, Python 3.14.8.) On an environment where those stdlib tests
happen to pass under nose2, ./runtests would exit 0 while having tested the
standard library, which is the quieter and worse outcome. Since debian/rules
runs ./runtests in override_dh_auto_test unless nocheck is set, that is
presumably what has been happening.
The attached patch passes "-s test -t test", which makes nose2 treat the test
directory as both the start and the top-level directory, so modules there are
imported top-level and the stdlib package is never consulted.
I tried the two other obvious candidates and they are worse. Adding an empty
test/__init__.py does fix the import - "import test" then resolves to the
repository's directory, regular package beating namespace portion - but it
makes nose2 import test.test_indexer, whose "import tools" then fails with
ModuleNotFoundError, so it needs the test code changed too. And "-s test -t ."
does not work at all: nose2 reports "Start directory is not importable".
2. The existing TestIndexer tests use assert_, removed in Python 3.12
With collection fixed - nose2 run from inside test/ - the package's own tests
are found, and all four TestIndexer tests error:
ERROR: testAptRebuild (test_indexer.TestIndexer.testAptRebuild)
ERROR: testDeb822Rebuild (test_indexer.TestIndexer.testDeb822Rebuild)
ERROR: testIncrementalRebuild
(test_indexer.TestIndexer.testIncrementalRebuild)
ERROR: testIncrementalRebuildFromEmpty
(test_indexer.TestIndexer.testIncrementalRebuildFromEmpty)
AttributeError: 'TestIndexer' object has no attribute 'assert_'.
Did you mean: 'assertIn'?
unittest.TestCase.assert_ was a deprecated alias for assertTrue and was
removed in Python 3.12. There are 11 call sites in test/test_indexer.py:
$ grep -c 'assert_(' test/test_indexer.py
11
$ python3 -c "import unittest; print(hasattr(unittest.TestCase, 'assert_'))"
False
So even with collection working, the suite cannot pass on any Python from
3.12 onward. The attached patch replaces assert_ with assertTrue at those 11
sites, which is what assert_ was an alias for; no assertion changes meaning.
WHAT THE PATCH DOES NOT FIX
With both changes applied the package's four tests are collected and execute,
and they still do not pass here - for a third reason the patch deliberately
leaves alone:
ERROR: testAptRebuild (test_indexer.TestIndexer.testAptRebuild)
File "/usr/lib/python3/dist-packages/apt/cache.py", line 280, in __getitem__
rawpkg = self._cache[key]
KeyError: 'libept-dev'
The fixtures name libept-dev at three sites in test/test_indexer.py, and that
package does not exist in Ubuntu 26.10 - "apt-cache policy libept-dev" returns
nothing at all. So the tests depend on specific packages being present in the
local apt cache. That is a fixture assumption rather than a harness fault, and
how to handle it - skip when absent, or choose packages that are always
present - seemed a decision for you rather than for me.
So this patch moves the suite from "runs 70 of Python's tests and none of
yours" to "runs yours, four of which fail on a missing fixture package". That
is progress rather than a green suite, and I would rather say so than imply
otherwise.
For completeness: this applies cleanly alongside the relations.py patch in my
other report. With both, "./runtests -v" collects 10 tests - the 6 new
relations tests pass and the 4 TestIndexer tests fail on the libept-dev
fixture above.
-- System Information:
Distribution: Ubuntu 26.10 (stonking)
Architecture: amd64
Python: 3.14.8
nose2: 0.16.0
apt-xapian-index: 0.59
Also reported to Debian as https://bugs.debian.org/1155493 , with the
same patch attached.
** Affects: apt-xapian-index (Ubuntu)
Importance: Undecided
Status: New
** Tags: patch
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2177237
Title:
test suite does not run: ./runtests collects Python's stdlib tests,
and TestIndexer uses assert_ removed in 3.12
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apt-xapian-index/+bug/2177237/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs