-
Notifications
You must be signed in to change notification settings - Fork 214
Combine issues in tox examples for coverage 5 #386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Possibly related to nedbat/coveragepy#713, append has been working unexpectedly for me well before coverage 5. |
Facing the same issue here. It would be great if, as per suggestion, In the current implementation, Alternatively, if the old behaviour is to be preserved, it would be great to enable a new option like |
IMO pytest-cov shouldn't even allow users changing the Having a |
If a user explicitly sets a value for Regarding the use case, the issue arose when combining results from parallel runs across python versions, which I believe is a common use case for projects supporting several python versions. We have a matrix job run using github actions, where multiple environments with different python versions are spun up in parallel, and test suite run simultaneously. Once all these runs are completed, coverage results directory each job is combined into a working directory, and Since all this is run using tox we currently use a config very similar to the one in the description. An alternative workaround, is to add a step to each CI job to rename the file. |
Ok so just to understand it correctly ... test suites are ran in parallel, in the same filesystem yes? |
No, they are run on independant and isolated hosts. And the only way to get all the files together is to export from the test job and import into an aggregator job once all test jobs are completed. |
I believe we can have our cake and eat it.
Currently pytest-cov has a workflow that overrides the self.cov = coverage.Coverage(source=self.cov_source,
branch=self.cov_branch,
config_file=self.cov_config)
+ if self.cov.config.data_suffix:
+ self.cov.config.data_file += '.' + coverage.misc.filename_suffix(self.cov.config.data_suffix)
self.combining_cov = coverage.Coverage(source=self.cov_source,
branch=self.cov_branch,
data_file=os.path.abspath(self.cov.config.data_file),
config_file=self.cov_config) |
@joshringer or anyone: fyi there's a big change in master now to how --cov-append works. Give it a try now, there'll be a new pytest-cov release soon. |
Nice, v2.9.0 looks good to me. Thanks! |
Re: d3daf76
I have been looking into this a bit today. It appears from the latest coveragepy source that the only reference to the
[paths]
config—or at least the only reference I could find—is here.This means that the filepaths are not combined properly somehow when merely doing
--cov-append
(I'm guessing this difference has something to do with the new db format for the .coverage data file).I have managed a workaround by setting a different data file per environment and then combining during the report step, i.e. for examples/src-layout/tox.ini:
I suspect the "correct" fix here is to have pytest-cov respect the
[run] parallel
flag and add a suffix to the data file as vanilla coverage does. This would at least remove the need for the uglysetenv
above. It would kinda break old behaviour though, needing to add acoverage combine
down there, so it would probably have to wait for pytest-cov 3.0...The text was updated successfully, but these errors were encountered: