Skip to content

werkzeug 0.15.0: mystery "generated" module when invoking coverage #1487

@asottile

Description

@asottile

This seems to be a minimal reproduction:

(note I made a virtualenv one level up to avoid that being in the coverage output)

.coveragerc

[run]
source = .

t.py

import flask

app = flask.Flask(__name__)

@app.route('/foo/<a>')
def hello(a):
    return 'world'


# pretend this is a test
with app.test_request_context():
    with app.test_client() as client:
        client.get(flask.url_for('hello', a='1'))

runtime

$ bash -xc 'coverage erase && coverage run t.py && coverage report && coverage xml'
+ coverage erase
+ coverage run t.py
+ coverage report
generated   NoSource: No source for code: '/tmp/t/generated'.
Aborting report output, consider using -i.
Name    Stmts   Miss  Cover
---------------------------
t.py        7      0   100%
+ coverage xml
No source for code: '/tmp/t/generated'.
Aborting report output, consider using -i.

triage (?)

This appears to come from here:

"generated",

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:

[run]
# ...
omit =
    *generated

in .coveragerc

though ideally I wouldn't have to exclude this 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions