Thread View: linux.debian.bugs.dist
1 messages
1 total messages
Started by Stuart Prescott
Thu, 12 Nov 2026 02:00
Bug#1153789: pybuild-plugin-autopkgtest: Stop exempting unittests "NO TESTS RAN" as a failure for autopkgtests
Author: Stuart Prescott
Date: Thu, 12 Nov 2026 02:00
Date: Thu, 12 Nov 2026 02:00
58 lines
3993 bytes
3993 bytes
Package: pybuild-plugin-autopkgtest
Version: 7.20261030
Severity: normal
X-Debbugs-Cc: stuart@debian.org
Dear Maintainer,
unittests exits 5 "NO TESTS RAN" when it can't find any tests; this can
happen either when pybuild is just poking around trying to see if it can
find some tests to run, and so this failure is ignored at build time.
Ignoring it is labelled as a "temporary hack" 3 years ago and I suspect
we're no closer to being able to remove that.
However, when a package has said "Testsuite: autopkgtest-pkg-pybuild",
this is an explicit opt-in to run tests, and failing to find the tests
should be treated as a test failure. An autopkgtest that claims to run
tests and does not is RC-buggy.
I've just found a package (python-grpcio-status) which declared
"Testsuite: autopkgtest-pkg-pybuild" and had no tests; the result is
that ci.d.n gets a test log with "NO TESTS RAN" but marks the tests as
successful even though nothing actually got tested. Rather than getting
a migration bounty for having an autopkgtest, it should get an RC bug
for having a buggy one.
From dh-python's dhpython/build/base.py:shell_command
```
output = self.execute(context, args, command=command, log_file=log_file)
if output.returncode == 5 and args.ignore_no_tests:
# Temporary hack (see Base.test)
pass
elif output.returncode != 0:
msg = f'exit code={output.returncode}: {command}'
if log_file:
msg += f'\nfull command log is available in {log_file}'
raise Exception(msg)
```
I think it's appropriate to switch the default for `ignore_no_tests` to
False for the autopkgtest case. That could be done by tweaking the following
in `test_cmd` to be aware of the context in which it is run. I suspect
that it is available within the `context` as `context.args.autopkgtest`;
it could also be pulled from the `PYBUILD_AUTOPKGTEST` environment
variable if needed.
```
log.warning(
"No test runner selected, defaulting to unittest, ignoring "
"test discovery problems.\nUse --test-unittest to explicitly "
"select the unittest runner.")
# As this is the fallback option, we allow 0 discovered tests.
args.ignore_no_tests = True
return 'cd {build_dir}; {interpreter} -m unittest discover -v {args}'
```
regards
Stuart
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads