Skip to content

Commit 2e20eb7

Browse files
committed
test: run tests with DEVMODE
1 parent bedb949 commit 2e20eb7

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

tests/test_concurrency.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,9 @@ def try_multiprocessing_code(
489489
""",
490490
)
491491

492+
# Dev mode turns on deprecation warnings that some concurrency
493+
# libraries issue. We don't need to see those.
494+
self.del_environ("PYTHONDEVMODE")
492495
cmd = f"coverage run {args} multi.py {start_method}"
493496
_, out = self.run_command_status(cmd)
494497
expected_cant_trace = cant_trace_msg(concurrency, the_module)

tests/test_report.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -880,16 +880,17 @@ def test_report_with_chdir(self) -> None:
880880
print("Line One")
881881
os.chdir("subdir")
882882
print("Line Two")
883-
print(open("something", encoding="utf-8").read())
883+
with open("something", encoding="utf-8") as f:
884+
print(f.read())
884885
""",
885886
)
886887
self.make_file("subdir/something", "hello")
887888
out = self.run_command("coverage run --source=. chdir.py")
888889
assert out == "Line One\nLine Two\nhello\n"
889890
report = self.report_from_command("coverage report")
890-
assert self.last_line_squeezed(report) == "TOTAL 5 0 100%"
891+
assert self.last_line_squeezed(report) == "TOTAL 6 0 100%"
891892
report = self.report_from_command("coverage report --format=markdown")
892-
assert self.last_line_squeezed(report) == "| **TOTAL** | **5** | **0** | **100%** |"
893+
assert self.last_line_squeezed(report) == "| **TOTAL** | **6** | **0** | **100%** |"
893894

894895
def test_bug_156_file_not_run_should_be_zero(self) -> None:
895896
# https://github.com/coveragepy/coveragepy/issues/156

tox.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ setenv =
3131
pypy3{,10,11}: COVERAGE_TEST_CORES=pytrace
3232
PYTHONWARNDEFAULTENCODING=1
3333
PYTHONWARNINGS=ignore::EncodingWarning:pip._internal.utils.subprocess,ignore::EncodingWarning:pip._internal.configuration
34-
# Disable CPython's color output
34+
# Try to be strict during testing. https://docs.python.org/3/library/devmode.html
35+
PYTHONDEVMODE=1
36+
# Disable CPython's color output.
3537
PYTHON_COLORS=0
3638

3739
# $set_env.py: COVERAGE_PIP_ARGS - Extra arguments for `pip install`

0 commit comments

Comments
 (0)