Test infrastructure¶
These tests check the tooling that runs and reports the other tests: the
category recap, the live progress estimate, and the coverage metrics. They
don’t build or render the theme. They are the only tests in the “Test
infrastructure” recap line, which has no category number because it isn’t one
of the testing strategy categories. All of them
are fast and run with make test.
Reporting and progress¶
tests/test_test_reporting.py checks the behaviour described in
Test output convention and Progress and time left. Most tests
call the reporting functions in tests/conftest.py directly, with fake
reports. The last test runs a real pytest session.
Test |
What it checks |
|---|---|
|
Test files map to their category and tier, including the slow-tier override for |
|
Each parameter counts as its own case, and different categories get separate lines. |
|
Failures, fixture errors, skips and unfinished cases each appear in the breakdown. |
|
An expected failure ( |
|
Fast and slow results share one line. |
|
A failing tier doesn’t hide a passing tier on the same line. |
|
Each case from an unmapped file is listed by its pytest ID, with its outcome. |
|
Unmapped cases don’t change the counts of mapped categories. |
|
Only the passing count and |
|
The time left adds up previous durations and uses an average for new tests. Nothing is shown when there’s no data. |
|
In a real pytest run, a new unmapped file appears in the recap by test ID, with no setup. |
These tests don’t check terminal drawing, such as escape codes or line width,
or behaviour with xdist. To see the real output, run make test in a terminal.
Coverage metrics¶
tests/test_coverage_metrics.py checks the helpers behind the three
percentages described in Test coverage, using small sample files in a
temporary folder. Its workflow regression executes the baseline-build step
in a temporary Git repository with a stand-in for make.
Test |
What it checks |
|---|---|
|
A function that never ran isn’t counted as covered, even inside a script that did run. |
|
Line numbers stay correct after non-ASCII characters, and comment lines aren’t counted. |
|
A theme script that no page loaded counts as 0%, rather than being left out. |
|
The totals count lines across all files instead of averaging per-file percentages. Python branch counts are kept out of the line percentage. |
|
A JavaScript report that is missing a theme script stops the summary instead of producing a higher percentage. |
|
A decrease hidden by rounding to one decimal place still fails the pull request check. |
|
A missing baseline skips the comparison instead of counting as 0%. |
|
The workflow runs both build targets without replacing the base’s tests, feature manifest or inventory with PR files. |
These tests don’t run Chromium or coverage.py; make test-coverage does.
Supporting modules¶
Module |
Role |
|---|---|
|
Sets up the shared docs build, assigns test categories, and produces the recap, the live progress estimate and the feature coverage results. |
|
Converts Chromium’s coverage data into line coverage for the theme’s scripts. |
|
Prints the three coverage figures at the end of |
|
Compares a pull request’s coverage with its base revision in the |
When to add a test here¶
Add or update a test here when you change the recap, the progress estimate, or
the coverage scripts. A new test file in this category needs a
"Test infrastructure" entry in TEST_CATEGORIES; see
Add a test.