diff options
| author | Ned Batchelder <ned@nedbatchelder.com> | 2021-10-18 21:54:02 -0400 |
|---|---|---|
| committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-10-18 21:54:02 -0400 |
| commit | afe6cf34d022e8dbbaa47826c487a98ca6832721 (patch) | |
| tree | 4cd6ff9621ff6754fae94b398b14597ace432134 /coverage | |
| parent | 8021196662dcadf161cbeaebb3be4b0392b51803 (diff) | |
| download | python-coveragepy-git-afe6cf34d022e8dbbaa47826c487a98ca6832721.tar.gz | |
fix: avoid measuring generated code. #1160
Diffstat (limited to 'coverage')
| -rw-r--r-- | coverage/disposition.py | 2 | ||||
| -rw-r--r-- | coverage/inorout.py | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/coverage/disposition.py b/coverage/disposition.py index dfcc6def..1c39a9c1 100644 --- a/coverage/disposition.py +++ b/coverage/disposition.py @@ -30,6 +30,8 @@ def disposition_debug_msg(disp): """Make a nice debug message of what the FileDisposition is doing.""" if disp.trace: msg = f"Tracing {disp.original_filename!r}" + if disp.original_filename != disp.source_filename: + msg += f" as {disp.source_filename!r}" if disp.file_tracer: msg += ": will be traced by %r" % disp.file_tracer else: diff --git a/coverage/inorout.py b/coverage/inorout.py index 6bdac06e..3bc7e54e 100644 --- a/coverage/inorout.py +++ b/coverage/inorout.py @@ -317,6 +317,9 @@ class InOrOut: disp.reason = reason return disp + if original_filename.startswith('<'): + return nope(disp, "not a real original file name") + if frame is not None: # Compiled Python files have two file names: frame.f_code.co_filename is # the file name at the time the .pyc was compiled. The second name is |
