Skip to content

Commit 745d182

Browse files
committed
wip: more debugging
1 parent bce0f4c commit 745d182

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

coverage/core.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,22 @@ def __init__(
6969
elif dynamic_contexts:
7070
reason_no_sysmon = "doesn't yet support dynamic contexts"
7171

72-
# import contextlib # DELETE ME
73-
# with open("/tmp/foo.out", "a") as f:
74-
# with contextlib.redirect_stdout(f):
75-
# print(f"== Core.__init__({metacov=})")
76-
# print(f"{sys.argv = }")
77-
# print(f"{sys.orig_argv = }")
78-
# from coverage.debug import short_stack
79-
# print(short_stack(full=True))
80-
# for name, val in os.environ.items():
81-
# if name.startswith(("COV", "PY")):
82-
# print(f"{os.getpid()}: {name} = {val!r}")
72+
import contextlib # DELETE ME
73+
with open("/tmp/foo.out", "a") as f:
74+
with contextlib.redirect_stdout(f):
75+
print(f"== Core.__init__({metacov=})")
76+
print(f"{sys.argv = }")
77+
print(f"{sys.orig_argv = }")
78+
import coverage
79+
cur = coverage.Coverage.current()
80+
if cur is not None:
81+
print(f"{cur._collector}")
82+
print(f"{cur._collector._collectors}")
83+
from coverage.debug import short_stack
84+
print(short_stack(full=True))
85+
for name, val in os.environ.items():
86+
if name.startswith(("COV", "PY")):
87+
print(f"{os.getpid()}: {name} = {val!r}")
8388

8489
core_name: str | None = None
8590
if config.timid:

coverage/inorout.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,12 @@ def check_include_omit_etc(self, filename: str, frame: FrameType | None) -> str
422422
# We exclude the coverage.py code itself, since a little of it
423423
# will be measured otherwise.
424424
if self.cover_match.match(filename):
425+
import contextlib # DELETE ME
426+
with open("/tmp/foo.out", "a") as f:
427+
with contextlib.redirect_stdout(f):
428+
print(f"{os.getpid()}: inorout part of coverage.py")
429+
from coverage.debug import short_stack
430+
print(short_stack(full=True))
425431
return "is part of coverage.py"
426432

427433
# If we aren't supposed to trace installed code, then check if this

0 commit comments

Comments
 (0)