-
-
Notifications
You must be signed in to change notification settings - Fork 439
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
Coverage not creating any output file #232
Comments
The only odd thing I see in the "debug sys" output is that you are using PyTracer instead of CTracer, it looks like you couldn't compile the C extension on installation. That shouldn't produce the problem you are seeing, but you'll want to fix that, because it will slow down your test runs. Are you using any libraries for starting or stopping processes, or using exotic multi-threading techniques? A few of these are listed at http://nedbatchelder.com/code/coverage/trouble.html Anything unusual that you might be using in your library might be a clue. |
Original comment by jalder (Bitbucket: jalder, GitHub: jalder) Just fixed the CTracer, thanks for the hint. I searched the code again and found some process stuff (multiprocessing (bad), subprocess (ok?), threading (ok?)) but those are all in some implementation classes and not in the framework code i execute with the component tests mentioned here. Apart from those I couldn't find any unusual modules. I'm really wondering why coverage isn't producing any data at all. Is this the default behavior if no executed code is traced? |
Coverage will say "No data to report" if there is no data collected. Can you show the result of "coverage debug data" after your "coverage run .." command? |
Original comment by jalder (Bitbucket: jalder, GitHub: jalder) Here you are..
|
Is it possible that your program is interfering with writing the .coverage data file? When I run coverage and collect no data, I get a 48-byte .coverage file anyway, and also a warning during the run phases, "No data was collected". Is there any chance you can share the code your are running? |
Original comment by Sorin Sbarnea (Bitbucket: sorin, GitHub: sorin) The problem is quite simple, if any of the tests are changing the current directory, coverage will end-up using the wrong directory. The only solution to this is to make coverage determine the output directory before starting the tests. |
Sorin: that's not true. The "debug sys" output shows the path that coverage will use for the data file, even if the tests change the directory. Have you encountered problems with a changed directory? Coverage.py used to have a problem with changing directories, but it's been fixed for 3.5 years: see issue #24. |
jalder: any more information? |
Original comment by Mark M Evans (Bitbucket: markmevans, GitHub: markmevans) I have seen the Our project is rather complex, so I can't provide a simple code sample yet (and it seemed timing dependent.) We do have atexit handlers of our own as well as signal handlers. If I learn more, I'll pass it on. Just like everyone, I'm in the middle of a release cycle so it may be a while before I can look more deeply into it. :) |
Feel free to re-open this issue if you get more information. |
Original comment by todd staples (Bitbucket: Toddstaples, GitHub: Toddstaples) i'm having a similar issue over here .. but only in my container. Figured i'd share hoping that maybe someone will see this and know what is going on. Probably going to post this on stackoverflow at this point too cause i'm baffled. Basically my situation is this. I'm starting a python based (pyramid) web services app. Simple enough. I want to get coverage numbers on it so I start it by doing "coverage run /path/path/path/app.py". Again.. simple enough. We just created a container for this.. so now i want to do the same thing inside the container.. get the coverage information after testing the web services as they're running in the container, run a report, and then stop the container. Shouldn't be a huge issue... BUT IT IS! If i build the container with an ENTRYPOINT or CMD starting the app.. like these.. and yes i've tried them all.. ENTRYPOINT coverage run /path/path/path/app.py and then start the container like this docker run --name stage1-latest-container-instance -itp 56432:56432 stage1-latest or even this in the case of the CMD entries in the dockerfile (since they're default, and i'm overriding them with this command) docker run --name stage1-latest-container-instance -itp 56432:56432 stage1-latest coverage run /path/path/path/app.py my app starts perfectly fine.. works no problem.. BUT no .coverage file is created! no where in the container do i see a .coverage file.. Ok.. trying a diff approach Keep just rebuild it... And then run the container with which gives me a prompt in the docker container. Then from another window do this docker exec -it stage1-latest-container-instance coverage run /path/path/path/app.py STILL! no .coverage file gets created. I've even created a file called runapp.sh and put the following lines in it
and then started the container with docker run --name stage1-latest-container-instance -itp 56432:56432 stage1-latest /path/runapp.sh and tried still no .container file ok.. last resort.. go into the prompt that I got after i ran the "docker run" with just "CMD bash" in the dockerfile in interactive mode (-it).. and start my app with coverage in there manually. [root@ac25fb69bb2e /]# coverage run /path/path/path/app.py AND AMAZINGLY.. the .coverage file is created no problem.... WHAT THE HECK! |
Original comment by todd staples (Bitbucket: Toddstaples, GitHub: Toddstaples) figured out a fix for my issue.. please check it out over on stackoverflow if interested [https://stackoverflow.com/questions/48692363/coverage-run-app-py-inside-a-docker-container-not-creating-coverage-file/48710256#48710256](Link URL) |
Originally reported by jalder (Bitbucket: jalder, GitHub: jalder)
When I try to run a component test of our testing framework, coverage is not willing to produce any output file (.coverage) and thus failes to generate a report.
Apart from this, coverage is not reporting any errors.
As this is our framework for component tests up to system integration tests there is quite some stuff happening in there...
Do you have any advice on how to track this issue? Is there any verbose mode for coverage?
If I run coverage with a simple script it works perfectly, so the installation seems fine.
PS: Thanks for all of this and keep up the good work!
The text was updated successfully, but these errors were encountered: