Skip to content

Conversation

callumforrester
Copy link
Contributor

The default CLI test in new projects runs __main__.py in a subprocess, until pytest-cov 7.0.0 subprocesses were automatically included in coverage but that has now changed and we must explicitly enable it in order to avoid sudden unexpected drops in code coverage.

See docs: https://pytest-cov.readthedocs.io/en/latest/subprocess-support.html

The default CLI test in new projects runs `__main__.py` in a subprocess, until pytest-cov 7.0.0 subprocesses were automatically included in coverage but that has now changed and we must explicitly enable it in order to avoid sudden unexpected drops in code coverage.

See docs: https://pytest-cov.readthedocs.io/en/latest/subprocess-support.html
@callumforrester callumforrester changed the title Enable subprocess coverage fix: Enable subprocess coverage Sep 15, 2025
@AlexanderWells-diamond
Copy link
Contributor

It's not directly related to this project, but the upgrade to pytest-cov 7.0.0 removed pytest_cov.embed, which I had been using to get code coverage to work properly with multiprocessing tests. It is quite likely some projects will start seeing ImportErrors when they upgrade to 7.0.0.

@callumforrester
Copy link
Contributor Author

@AlexanderWells-diamond lovely...

Is there a similar workaround for that?

@AlexanderWells-diamond
Copy link
Contributor

@AlexanderWells-diamond lovely...

Is there a similar workaround for that?

Yes, it's another coverage setting, documented here: https://coverage.readthedocs.io/en/latest/config.html#config-run-concurrency

@callumforrester
Copy link
Contributor Author

Given that this one doesn't break the template I'm tempted to leave it out and have people enable it as-and-when they need it

@callumforrester callumforrester merged commit ace29b9 into main Sep 16, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants