14
0

- Add traced_file_absolute.patch to fix gh#nedbat/coveragepy#1161.

- Switch off test_debug_trace started to avoid failure
  (gh#nedbat/coveragepy#1161).

- Update to 5.5:
  - coverage combine has a new option, --keep to keep the original data
    files after combining them. The default is still to delete the files
    after they have been combined. This was requested in issue 1108 and
    implemented in pull request 1110. Thanks, Éric Larivière.
  - When reporting missing branches in coverage report, branches aren’t
    reported that jump to missing lines. This adds to the long-standing
    behavior of not reporting branches from missing lines. Now branches
    are only reported if both the source and destination lines are
    executed. Closes both issue 1065 and issue 955.
  - Minor improvements to the HTML report:
    - The state of the line visibility selector buttons is saved in
      local storage so you don’t have to fiddle with them so often,
      fixing issue 1123.
    - It has a little more room for line numbers so that 4-digit numbers
      work well, fixing issue 1124.
  - Improved the error message when combining line and branch data, so
    that users will be more likely to understand what’s happening,
    closing issue 803.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-coverage?expand=0&rev=92
This commit is contained in:
2021-05-09 22:28:09 +00:00
committed by Git OBS Bridge
parent cb359ddb8a
commit 3f641ff159
5 changed files with 111 additions and 6 deletions

View File

@@ -0,0 +1,66 @@
From 06cb51b39620e2140f915393f0f41b281594e05b Mon Sep 17 00:00:00 2001
From: Ned Batchelder <ned@nedbatchelder.com>
Date: Sat, 8 May 2021 21:27:45 -0400
Subject: [PATCH] test: traced file names seem to be absolute now? #1161
This was changed in 3.10.0b1 and 3.9.5. Seems like a strange change to
throw into 3.9.5, but there it is. Fixes #1161.
---
tests/test_debug.py | 6 ++++--
tests/test_oddball.py | 16 +++++++++-------
2 files changed, 13 insertions(+), 9 deletions(-)
--- a/tests/test_debug.py
+++ b/tests/test_debug.py
@@ -124,8 +124,10 @@ class DebugTraceTest(CoverageTest):
def test_debug_trace(self):
out_lines = self.f1_debug_output(["trace"])
- # We should have a line like "Tracing 'f1.py'"
- assert "Tracing 'f1.py'" in out_lines
+ # We should have a line like "Tracing 'f1.py'", perhaps with an
+ # absolute path.
+ f1 = re_lines(out_lines, r"Tracing '.*f1.py'")
+ assert f1
# We should have lines like "Not tracing 'collector.py'..."
coverage_lines = re_lines(
--- a/tests/test_oddball.py
+++ b/tests/test_oddball.py
@@ -451,10 +451,12 @@ class GettraceTest(CoverageTest):
def test_setting_new_trace_function(self):
# https://github.com/nedbat/coveragepy/issues/436
self.check_coverage('''\
+ import os.path
import sys
def tracer(frame, event, arg):
- print("%s: %s @ %d" % (event, frame.f_code.co_filename, frame.f_lineno))
+ filename = os.path.basename(frame.f_code.co_filename)
+ print("%s: %s @ %d" % (event, filename, frame.f_lineno))
return tracer
def begin():
@@ -474,16 +476,16 @@ class GettraceTest(CoverageTest):
a = 21
b = 22
''',
- lines=[1, 3, 4, 5, 7, 8, 10, 11, 12, 14, 15, 16, 18, 19, 20, 21, 22],
- missing="4-5, 11-12",
+ lines=[1, 2, 4, 5, 6, 7, 9, 10, 12, 13, 14, 16, 17, 18, 20, 21, 22, 23, 24],
+ missing="5-7, 13-14",
)
out = self.stdout().replace(self.last_module_name, "coverage_test")
expected = (
- "call: coverage_test.py @ 10\n"
- "line: coverage_test.py @ 11\n"
- "line: coverage_test.py @ 12\n"
- "return: coverage_test.py @ 12\n"
+ "call: coverage_test.py @ 12\n"
+ "line: coverage_test.py @ 13\n"
+ "line: coverage_test.py @ 14\n"
+ "return: coverage_test.py @ 14\n"
)
assert expected == out