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

Non existing path set in data_file causes an exception #721

Closed
butla opened this issue Oct 17, 2018 · 3 comments
Closed

Non existing path set in data_file causes an exception #721

butla opened this issue Oct 17, 2018 · 3 comments

Comments

@butla
Copy link

butla commented Oct 17, 2018

Reproduction:

  1. Create an empty dir /var/tmp/test
  2. In .coveragerc, section [run] set data_file to /var/tmp/test/inner/.coverage
  3. Run any test with that.
  4. FileNotFoundError is raised.

My proposition:
I'd like for that to just create the directory structure for the file. I think it can be done with os.path.dirname() and os.makedirs() here https://github.com/nedbat/coveragepy/blob/master/coverage/data.py#L495
Should that be OK?
Is there any reason not to implement that?

More context:
I'd use that when measuring coverage in an application's Docker container. Sadly, I can't just use whatever directory there is and then just issue a docker cp with a wildcard pattern to get all the .coverage.* files from the container before merging the data, because that's not implemented moby/moby#7710 I can work around that, but maybe it'd just be nice if I didn't have to.

@nedbat
Copy link
Owner

nedbat commented Oct 21, 2018

Implemented in 8271bf4

@nedbat nedbat closed this as completed Oct 21, 2018
@butla
Copy link
Author

butla commented Oct 21, 2018

Thanks!

@nedbat
Copy link
Owner

nedbat commented Nov 25, 2018

This was released as part of 5.0a4.

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

No branches or pull requests

2 participants