unit tests: fix runtests.sh not filtering tests when passed a subdirectory
Metadata
Current evaluation
Merged PR #3305 in e64c08aed, fixing runtests.sh to run only the requested test subdirectory instead of collecting the entire unit suite.
Resolution: closed resolved
Reason: The one-line correction was merged as commit e64c08aed. A subdirectory argument now correctly filters pytest collection, reducing the commands suite from 3,842 collected tests to 295.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Instructions in `TESTING.md` for testing a subsuite don't work as expected: it just runs the whole suite.
Before:
```sh
$ ./runtests.sh tests/unit/commands
...
collected 3842 items
...
```
After:
```sh
$ ./runtests.sh tests/unit/commands
...
collected 295 items
...
```
- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `./runtests.sh static`?
- `shellcheck` throws a bunch of warnings, but I believe these are not related with this change at all.
- [ ] Have you successfully run `./runtests.sh tests/unit`?
- 3 tests fail out of 3842 but, again, it must be a local setup issue:
```
FAILED tests/unit/test_config.py::TestConfig::test_save_encoded_to_file
FAILED tests/unit/commands/test_whoami.py::WhoamiCommandBaseTestCase::test_unknown_email_must_suggest_logout_and_login
FAILED tests/unit/commands/test_whoami.py::WhoamiCommandBaseTestCase::test_whoami_must_print_email_and_developer_id
```
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #3305 in e64c08aed, fixing runtests.sh to run only the requested test subdirectory instead of collecting the entire unit suite. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #3305 fixed runtests.sh to filter tests by a supplied subdirectory, reducing tests/unit/commands collection from 3,842 to 295 tests (commit e64c08aed). | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #3305 fixed runtests.sh to honor a test subdirectory argument, reducing the example run from 3842 collected tests to 295. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #3305 (e64c08aed), fixing runtests.sh to filter to a supplied test subdirectory instead of running the entire suite. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged a one-line fix correcting runtests.sh to properly filter tests when a subdirectory is passed. Previously, the script ran the entire suite. Approved by two reviewers, passed CI, and merged. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for runtests.sh to correctly filter tests when a subdirectory is passed. The contributor resolved branch and CI failures, after which the change was approved and merged. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1015 tests: reorganize command tests into subdirectory. | snapcraft | merged | Merged PR #1015 as commit 90b63c94, moving command unit tests into a tests/unit/commands/ subdirectory (30 files, +70/-49) to shrink the unit suite and close LP #1651908. | |
| #3719 tests: fix lifecycle tests to run on new directory | snapcraft | merged | Merged PR #3719 via commit 314dd7574 to run lifecycle tests in a new directory instead of the current directory. |