-
-
Notifications
You must be signed in to change notification settings - Fork 438
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
Duplicate filenames reported when filename contains uppercase letters on windows. #203
Comments
What kind of report are you using? Are you moving files between operating systems, or is this purely on Windows? |
Thomas, I'm having trouble reproducing this. Could you show me a small reproducible case? |
Original comment by Thomas Maslach (Bitbucket: tmaslach, GitHub: tmaslach) I have attached a zip file with a really simple example. I'm running pytest, however, and just run with the following arguments (in the same dir as the files): py.test testTest.py --cov . I realized while creating this simple example that the problem only shows up once I add the |
Any chance we can make it happen without py.test? |
Original comment by Thomas Maslach (Bitbucket: tmaslach, GitHub: tmaslach) I tried, but no success. I'm not able to get SkippedTest to show up in the list. I'm probably not use the right switch is my guess. I can only get testtest to show up. My guess is that I don't know the switch to get the touch_file command to execute, but that is only a guess.. |
Original comment by Thomas Maslach (Bitbucket: tmaslach, GitHub: tmaslach) Ned - figured it out. Please use the attached .coveragerc file as well. That is, drop into the same location as the other files. You'll need to change the path in the .coveragerc file to wherever you place the files. It should point to directory that the files are in. When you do this, you'll notice testTest and testtest are reported on. As a side note, I did find another issue along the same lines. It seems I can't use source and omit the way I would expect it to work. Using the same example, let's say I specify the [run] source=. Then, I specify omit=SkippedTest. It won't omit SkippedTest because source will override omit.. What I have are a couple of py files in my package that don't run with the app (they are either experiments/developer demos). I want everything in the package included in coverage, except for these couple of files (ideally, I want them to show up in the list, but have all lines excluded from coverage). Is there a way to do this? I can create another issue for this, if you want, or maybe post this in the forums.. Thanks! |
Fixed in <<changeset 31ca39cb1da5 (bb)>>. |
Originally reported by Thomas Maslach (Bitbucket: tmaslach, GitHub: tmaslach)
Our source code contains python files that have uppercase letters in the filenames. On windows, when running tests that utilize these source files, the coverage report is showing the files with uppercase letters twice in the list - once with the upper case letters, once in all lower case.
I have figured out why:
In data.py:
It seems touch_file is called for all files. Passed into it is the filename that contains upper cased letters.
For files that are partly coveraged, we also call add_line_data. The filename passed into here is the canonical filename which is gotten from File.py, FileLocator.canonical_filename. This function calls os.path.normcase, which lowers the case on windows. Uh-oh! We don't do that when we call touch_file, so files show up in the report twice when they have uppercased letters..
How to fix? I'm not sure what the right solution is, but my guess is we should call the canonical_filename function before calling touch_file. This would be in control.py.
Let me know if you have any questions.. My fix is just a suggestion... Thanks!
The text was updated successfully, but these errors were encountered: