-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
werkzeug 0.15.0: mystery "generated" module when invoking coverage #1487
Comments
When werkzeug/src/werkzeug/routing.py Lines 1102 to 1115 in 86f7bdf
|
I think |
@asottile I'll give that a try. Was about to write this whole thing, so I'll post anyway. :-) For clarity, the code above is better as a dict: code_args = {
"argcount": argcount,
"nlocals": len(self.var),
"stacksize": peak_stack + len(self.var),
"flags": flags,
"codestring": ops,
"constants": tuple(self.consts),
"names": (),
"varnames": tuple(self.var),
"filename": __file__,
"name": "_build_unknown" if append_unknown else "_build",
"firstlineno": 1,
"lnotab": b"",
}
if not PY2:
code_args["kwonlyargcount"] = 0
co = types.CodeType(**code_args) I'm not really sure what the correct answer is. It's weird that this isn't causing the same error in Werkzeug's own coverage. How will coverage react if I tell it that the generated function is part of that module, what line do I say it starts on, what does it do when the |
|
inspecting the coverage data I see two arcs, one from I think Lines 18 to 22 in 86f7bdf
Which avoids the "generated" file at |
Tests still pass with |
woops, my suggestion was wrong, and I'm concerned about the test suite now 😨
Setting it to |
🤦♂️ I didn't actually set it to |
It looks like >>> s = 'print("hi")\ndef f(): pass\nprint(repr(f.__code__.co_filename))'
>>> exec(s)
hi
'<string>' |
Yeah, I was looking at |
yep! (this is in |
Yeah, just found that, it skips empty or |
I'd go with |
(I got a new job, I'm trying to find the time to get back into this...) |
No worries, I've already got a branch I'll PR later. |
This reverts commit d49e4ee.
Revert "Workaround pallets/werkzeug#1487"
This seems to be a minimal reproduction:
(note I made a virtualenv one level up to avoid that being in the coverage output)
.coveragerc
t.py
runtime
triage (?)
This appears to come from here:
werkzeug/src/werkzeug/routing.py
Line 1111 in 86f7bdf
or, at least, that's the only instance of
'generated'
or"generated"
in my site-packages -- so I may be guessing a bit here.This is causing CI failures in https://github.com/asottile/git-code-debt
workaround
A workaround appears to be setting this:
in
.coveragerc
though ideally I wouldn't have to exclude this 🤔
The text was updated successfully, but these errors were encountered: