🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #4210

Bug#1153789: pybuild-plugin-autopkgtest: Stop exempting unittests "NO TESTS RAN" as a failure for autopkgtests

#4210
From: Stuart Prescott
Date: Thu, 12 Nov 2026 02:00
58 lines
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
Technical Details
Message-ID: <NYsgx-bkTc-3@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.corradoroberto.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.corradoroberto.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod
From: Stuart Prescott <stuart@debian.org>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1153789: pybuild-plugin-autopkgtest: Stop exempting unittests "NO TESTS RAN" as a failure for autopkgtests
Date: Thu, 12 Nov 2026 03:00:01 +0100
Message-ID: <NYsgx-bkTc-3@gated-at.bofh.it>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Thu Nov 12 01:57:09 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.9
Reply-To: Stuart Prescott <stuart@debian.org>, 1153789@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: stuart@debian.org, piotr@debian.org
X-Debian-Pr-Message: report 1153789
X-Debian-Pr-Package: pybuild-plugin-autopkgtest
X-Debian-Pr-Source: dh-python
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Mailer: reportbug 13.2.0
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2002144
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 58
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Thu, 12 Nov 2026 12:54:59 +1100
X-Original-Message-ID: <179444849934.1438583.442683541247451124.reportbug@trochilus.nanonanonano.net>