From 3f641ff159cdd9a4e02a5f8397ac0aa77d59cd1aec375bff7882c6f5b5a77b0a Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Sun, 9 May 2021 22:28:09 +0000 Subject: [PATCH] - Add traced_file_absolute.patch to fix gh#nedbat/coveragepy#1161. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- coverage-5.4.tar.gz | 3 -- coverage-5.5.tar.gz | 3 ++ python-coverage.changes | 34 ++++++++++++++++++++ python-coverage.spec | 11 +++++-- traced_file_absolute.patch | 66 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 111 insertions(+), 6 deletions(-) delete mode 100644 coverage-5.4.tar.gz create mode 100644 coverage-5.5.tar.gz create mode 100644 traced_file_absolute.patch diff --git a/coverage-5.4.tar.gz b/coverage-5.4.tar.gz deleted file mode 100644 index ebabbeb..0000000 --- a/coverage-5.4.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d2e262e5e8da6fa56e774fb8e2643417351427604c2b177f8e8c5f75fc928ca -size 687727 diff --git a/coverage-5.5.tar.gz b/coverage-5.5.tar.gz new file mode 100644 index 0000000..98fb769 --- /dev/null +++ b/coverage-5.5.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ebe78fe9a0e874362175b02371bdfbee64d8edc42a044253ddf4ee7d3c15212c +size 691258 diff --git a/python-coverage.changes b/python-coverage.changes index 38d956c..dc73e24 100644 --- a/python-coverage.changes +++ b/python-coverage.changes @@ -1,3 +1,37 @@ +------------------------------------------------------------------- +Sun May 9 22:27:19 UTC 2021 - Matej Cepl + +- Add traced_file_absolute.patch to fix gh#nedbat/coveragepy#1161. + +------------------------------------------------------------------- +Sat May 8 18:47:01 UTC 2021 - Matej Cepl + +- Switch off test_debug_trace started to avoid failure + (gh#nedbat/coveragepy#1161). + +------------------------------------------------------------------- +Sat May 8 14:15:04 UTC 2021 - Matej Cepl + +- 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. + ------------------------------------------------------------------- Mon Feb 1 20:58:07 UTC 2021 - Dirk Müller diff --git a/python-coverage.spec b/python-coverage.spec index 99ce180..7361f08 100644 --- a/python-coverage.spec +++ b/python-coverage.spec @@ -18,12 +18,15 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-coverage -Version: 5.4 +Version: 5.5 Release: 0 Summary: Code coverage measurement for Python License: Apache-2.0 URL: https://github.com/nedbat/coveragepy Source: https://files.pythonhosted.org/packages/source/c/coverage/coverage-%{version}.tar.gz +# PATCH-FIX-UPSTREAM traced_file_absolute.patch gh#nedbat/coveragepy#1161 mcepl@suse.com +# traced file names seem to be absolute now? +Patch0: traced_file_absolute.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module flaky} BuildRequires: %{python_module hypothesis >= 4.57} @@ -41,7 +44,7 @@ Requires: python Requires: python-setuptools Requires: python-toml Requires(post): update-alternatives -Requires(postun): update-alternatives +Requires(postun):update-alternatives %python_subpackages %description @@ -50,7 +53,8 @@ the code analysis tools and tracing hooks provided in the Python standard library to determine which lines are executable, and which have been executed. %prep -%setup -q -n coverage-%{version} +%autosetup -p1 -n coverage-%{version} + # do not require xdist sed -i -e '/addopts/d' setup.cfg # writes in /usr/ @@ -92,6 +96,7 @@ for filepath in %{buildroot}%{_bindir}/coverage*-%{$python_bin_suffix}; do done } export PATH="$(pwd)/build/bin:$PATH" +%python_exec -mcoverage debug sys # the tests need the empty leading part for importing local test projects, the x is a dummy" export PYTHONPATH=":x" %pytest_arch -k 'not (test_get_encoded_zip_files or test_egg or test_doctest or test_unicode or test_version or test_multiprocessing_with_branching or test_farm or test_dothtml_not_python or test_one_of or test_bytes or test_encoding or test_multi or test_xdist_sys_path_nuttiness_is_fixed or test_debug_sys_ctracer)' diff --git a/traced_file_absolute.patch b/traced_file_absolute.patch new file mode 100644 index 0000000..5ab2cd0 --- /dev/null +++ b/traced_file_absolute.patch @@ -0,0 +1,66 @@ +From 06cb51b39620e2140f915393f0f41b281594e05b Mon Sep 17 00:00:00 2001 +From: Ned Batchelder +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 +