-
-
Notifications
You must be signed in to change notification settings - Fork 440
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
[low-prio] Possible bug: files without extensions misidentified as Python? #1488
Comments
Interesting... Jinja is templating the files, and using the template name as the "Python" file name when running the resulting Python code. You can run this with a simpler command and look at the data collected:
Notice the lines:
These are not Python files, but Jinja is turning them into Python code and using the original file name. The second and third files are ignored because their file extension excludes them. The first is considered a possible Python file because coverage.py wants to allow extensionless files being used as scripts. I'm not sure if there's a way to keep that behavior and also not pester you with warnings. |
That makes sense, thanks! I briefly wondered whether it'd be possible to test those extensionless-script files for a first-line starting with |
I'm thinking about closing this issue, although also considering what changes would be required to reduce these warnings. The best alternative to doing-nothing here (which would probably be fine) that I can think of would be:
One factor that I don't yet completely understand is: would Another relevant factor is that adding that new extension would affect not only the |
@nedbat what do you think about adding |
Sphinx v7.4.0 introduces support for the Even so: re-reading the thread, the detail about other scripts without extensions stands out as something that would require continued support; so I think I will close this and the associated pull request that I had opened. |
Describe the bug
While running
pytest
withcoverage
(v6.5.0) forsphinx
, I noticed an unusual warning in the output logs:Digging into the code to figure out where that's coming from, I found this conditional block:
coveragepy/coverage/python.py
Lines 240 to 242 in 0ac2453
To Reproduce
How can we reproduce the problem? Please be specific. Don't link to a failing CI job. Answer the questions below:
3.10
6.5.0
pytest --cov=sphinx --cov-config=setup.cfg
Expected behavior
No warning should appear.
Additional context
I realize that perhaps there could be input types / environments where files don't have extensions that have been supported for historic reasons - and I've read some of the context in #82. Even so it seems like maybe the file shouldn't be considered Python-y.
The text was updated successfully, but these errors were encountered: