Skip to content
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

Where do these .coverage.hostname.number.number files come from? #100

Closed
danijar opened this issue Dec 12, 2015 · 16 comments
Closed

Where do these .coverage.hostname.number.number files come from? #100

danijar opened this issue Dec 12, 2015 · 16 comments
Labels

Comments

@danijar
Copy link

danijar commented Dec 12, 2015

I cant remember changing anything but recently Pytest with Pytest-cov started creating a lot of file in the working directory in addition to the expected .coverage file.

.coverage.danijar-xps13-arch.18737.903083
.coverage.danijar-xps13-arch.19190.316378
.coverage.danijar-xps13-arch.19192.651456
.coverage.danijar-xps13-arch.19197.538345
.coverage.danijar-xps13-arch.19199.138180
.coverage.danijar-xps13-arch.19212.482496
.coverage.danijar-xps13-arch.19213.812768
.coverage.danijar-xps13-arch.19301.688885
...

Where do there files come from?

@ionelmc
Copy link
Member

ionelmc commented Dec 12, 2015

They appear if you use subprocesses or xdist.

@ionelmc
Copy link
Member

ionelmc commented Dec 12, 2015

They don't get removed at the end of the testrun?!

@danijar
Copy link
Author

danijar commented Dec 12, 2015

Ah, that's a useful bit of information. Yes, I use subprocess and on error, I sys.exit() so they probably cannot be cleaned up. Do you have an idea? Here is the code inside setup.py.

@ionelmc
Copy link
Member

ionelmc commented Dec 12, 2015

I mean, if you use subprocesses in your tests, then pytest-cov will automatically start measuring coverage in those processes (if they are python of course). That's what is making those files (besides using xdist).

@danijar
Copy link
Author

danijar commented Dec 13, 2015

Oh, I don't use subprocess in my tests, just in my setup.py to run pytest.

@ionelmc
Copy link
Member

ionelmc commented Dec 13, 2015

Does it reproduce without the setup.py shim?

@danijar
Copy link
Author

danijar commented Dec 13, 2015

Just tried that. The files are still created when I just run python -m pytest --cov=layered test or py.test --cov=layered test. Pytest version 2.8.5 and Pytest-cov version 2.2.0.

@ionelmc
Copy link
Member

ionelmc commented Dec 13, 2015

What's your coverage version?

@danijar
Copy link
Author

danijar commented Dec 13, 2015

Coverage is version 4.0.3. Pip says all of the three packages are up-to-date. Update: I just noticed messages of this form in the Pytest report:

Coverage.py warning: Couldn't read data from '/home/danijar/repository/layered/.coverage.danijar-xps13-arch.22012.752324': CoverageException: Doesn't seem to be a coverage.py data file

@ionelmc
Copy link
Member

ionelmc commented Feb 14, 2016

Is there a repository that reproduce the issue?

@ionelmc ionelmc added the bug label Feb 14, 2016
@danijar
Copy link
Author

danijar commented Feb 22, 2016

Yes, cloning danijar/layered and running python3 setup.py test reproduces the problem.

@iAnanich
Copy link

iAnanich commented Jul 3, 2017

Have the same issue when using asyncio with ProcessPoolExecutor.

At the testing, it is a lot of .coveage.<..> files, but 2 of them always not get removed after tests complete.

python 3.5.3, coverage==4.4.1 pytest==3.0.6 pytest-cov==2.5.1

@ionelmc
Copy link
Member

ionelmc commented Oct 28, 2017

So I've looked at @danijar code and I bet @iAnanich has the same problem: unclean multiprocessing pool shutdown. You should have a pool.join() or similar before the test using the pool is done.

@danijar
Copy link
Author

danijar commented Oct 28, 2017

Thanks for looking into this!

@danijar danijar closed this as completed Oct 28, 2017
@drorata
Copy link

drorata commented Oct 8, 2018

I have a similar issue when testing a piece of code which uses GridSearchCV. Under the hood, joblib.Parallel is used and I guess/understand that it somehow messes up the files generated.

Any idea how to resolve this issue?

@ionelmc
Copy link
Member

ionelmc commented Nov 20, 2018

@danijar pls open up a separate issue and give some details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants