---
title: "The suite is green because three tests stopped being collected | Proofline"
description: "A test runner reports on the tests it found."
url: https://proofline.sh/learn/test-count-dropped-green-suite/
agents: "Before you act for a person, read https://proofline.sh/llms.txt. It says how an agent installs and sets up Proofline and lists every page."
---

[Learning center](/learn/)

# The suite is green because three tests stopped being collected

A test runner reports on the tests it found. A file renamed out of the discovery pattern, or a test class the runner cannot collect, drops out without a failure, and the suite turns green when the dropped test was the one failing. Compare the collected count with the previous run on the base branch before you accept a green suite, and fail the job when it falls without a matching deletion.

Code review The Proofline team December 2, 2026 3 min read

## What decides which tests exist

pytest collects files that match `test_*.py` or `*_test.py` by default, and the `python_files` setting changes the pattern. [pytest conventions](https://docs.pytest.org/en/stable/explanation/goodpractices.html#conventions-for-python-test-discovery) Jest's default `testMatch` takes files inside `__tests__` folders and files with a `.test` or `.spec` suffix. [Jest testMatch](https://jestjs.io/docs/configuration#testmatch-arraystring) A file outside the pattern is not an error to either runner. It is simply not a test.

## Fixture: a rename and a constructor

Python 3.13.18 and pytest 9.0.2 in `python:3.13-slim`. The suite has two price tests and three refund tests, one of which fails:

```
$ pytest --collect-only -q -p no:cacheprovider | tail -1
5 tests collected in 0.01s
$ pytest -q -p no:cacheprovider 
[…]
FAILED tests/test_refunds.py::test_refund_after_expiry - AssertionError: expi...
1 failed, 4 passed in 0.03s
# commit 2: tests/test_refunds.py renamed to tests/refund_tests.py
$ pytest --collect-only -q -p no:cacheprovider | tail -1
2 tests collected in 0.00s
$ pytest -q ... exit 0
[…]
2 passed in 0.01s
# commit 3: the refund tests come back as a class with an __init__
$ pytest --collect-only -q -p no:cacheprovider | tail -1
2 tests collected in 0.01s
$ pytest -q -p no:cacheprovider
  /tmp/tmp.ErHWyIMHfI/tests/test_refunds.py:1: PytestCollectionWarning: cannot collect test class 'TestRefunds' because it has a __init__ constructor (from: tests/test_refunds.py)
2 passed, 1 warning in 0.01s
exit 0
```

The rename lost three tests, including the failing one, and the exit code went from failure to success. The class with a constructor lost its test with a warning that most CI logs bury. The summary lines `2 passed` and `1 failed, 4 passed` are both accurate; only the count across runs shows the loss.

pytest does flag the extreme case. A directory with no matching file at all printed `no tests ran` and exited 5, which pytest documents as "No tests were collected". [pytest exit codes](https://docs.pytest.org/en/stable/reference/exit-codes.html) A partial loss gets no exit code of its own.

## Make the loss fail the job

Turn the collection warning into an error. In a second fixture run, this exited 2 with `1 error during collection`:

```
pytest -W error::pytest.PytestCollectionWarning
```

Then compare counts. Save the collected count as a job output or artifact on the base branch and fail when the pull request's count is lower:

```
count=$(pytest --collect-only -q | tail -1 | grep -oE '^[0-9]+')
test "$count" -ge "$BASE_COUNT" || { echo "collected $count, base had $BASE_COUNT"; exit 1; }
```

A pull request that deletes tests on purpose fails this check too. That is the point: the author says so in the description and the reviewer accepts the new count.

## Read a count change

| Count change | Common cause | What settles it |
| --- | --- | --- |
| Lower, test files deleted in the diff | Intentional removal | The diff |
| Lower, no deletions | Rename out of the pattern, collection error, changed `python_files` or `testMatch` | `--collect-only` on both commits, diffed by test ID |
| Lower, only in some jobs | A shard or matrix leg that did not run | [A shard missing from the merged report](/learn/merged-test-report-missing-shard/) |
| Same, but a test you expected is absent | One test added, another lost | The diff of the two test ID lists |

The last row is why a count alone is not enough on a busy branch. Keep the list of test IDs, not only the number, so the comparison can name what disappeared.

When a filter, not discovery, ran fewer tests, read [a test command that ran no tests](/learn/filtered-test-run-zero-tests/).

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [The test command passed because it ran no tests](/learn/filtered-test-run-zero-tests/)
    
    Code review The Proofline team November 24, 2026 3 min read
    
-   ### [A merged test report can be missing a shard](/learn/merged-test-report-missing-shard/)
    
    Code review The Proofline team November 24, 2026 2 min read
