From 8196418c29098fd4272adaf8b0a947d987068193d056fe47135e0598f1f20417 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Wed, 12 May 2021 09:30:53 +0000 Subject: [PATCH] - Add change__file__report-dir.patch to fix another issue repored in gh#nedbat/coveragepy#1161. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-coverage?expand=0&rev=94 --- change__file__report-dir.patch | 36 ++++++++++++++++++++++++++++++++++ python-coverage.changes | 6 ++++++ python-coverage.spec | 6 +++++- 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 change__file__report-dir.patch diff --git a/change__file__report-dir.patch b/change__file__report-dir.patch new file mode 100644 index 0000000..e557dc0 --- /dev/null +++ b/change__file__report-dir.patch @@ -0,0 +1,36 @@ +From 01cbb8751f98e5a7de79699444cbc03647691616 Mon Sep 17 00:00:00 2001 +From: Ned Batchelder +Date: Tue, 11 May 2021 19:32:32 -0400 +Subject: [PATCH] fix: Python 3.8.10 changed how __file__ is reported when + running directories + +--- + coverage/execfile.py | 5 +++++ + tests/test_process.py | 2 +- + 2 files changed, 6 insertions(+), 1 deletion(-) + +--- a/coverage/execfile.py ++++ b/coverage/execfile.py +@@ -176,6 +176,11 @@ class PyRunner(object): + # directory. + for ext in [".py", ".pyc", ".pyo"]: + try_filename = os.path.join(self.arg0, "__main__" + ext) ++ # 3.8.10 changed how files are reported when running a ++ # directory. But I'm not sure how far this change is going to ++ # spread, so I'll just hard-code it here for now. ++ if env.PYVERSION >= (3, 8, 10): ++ try_filename = os.path.abspath(try_filename) + if os.path.exists(try_filename): + self.arg0 = try_filename + break +--- a/tests/test_process.py ++++ b/tests/test_process.py +@@ -852,7 +852,7 @@ class EnvironmentTest(CoverageTest): + expected = re_lines(expected, r'\s+"argv0":', match=False) + actual = re_lines(actual, r'\s+"argv0":', match=False) + +- assert expected == actual ++ assert actual == expected + + def test_coverage_run_is_like_python(self): + with open(TRY_EXECFILE) as f: diff --git a/python-coverage.changes b/python-coverage.changes index 362b314..ff38641 100644 --- a/python-coverage.changes +++ b/python-coverage.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed May 12 09:29:03 UTC 2021 - Matej Cepl + +- Add change__file__report-dir.patch to fix another issue repored + in gh#nedbat/coveragepy#1161. + ------------------------------------------------------------------- Tue May 11 10:44:16 UTC 2021 - Antonio Larrosa diff --git a/python-coverage.spec b/python-coverage.spec index 0bb734a..7c55d42 100644 --- a/python-coverage.spec +++ b/python-coverage.spec @@ -27,8 +27,12 @@ Source: https://files.pythonhosted.org/packages/source/c/coverage/covera # 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 -# PATCH-FIX-UPSTREAM 0001-make-data-collection-operations-thread-safe.patch alarrosa@suse.com -- Make data collection operations thread safe +# PATCH-FIX-UPSTREAM 0001-make-data-collection-operations-thread-safe.patch gh#nedbat/coveragepy#commit-e36b42e2db46 alarrosa@suse.com +# Make data collection operations thread safe Patch1: 0001-make-data-collection-operations-thread-safe.patch +# PATCH-FIX-UPSTREAM change__file__report-dir.patch gh#nedbat/coveragepy#1161 mcepl@suse.com +# Fix yet another regression in Python 3.8.10, this time about __file__ value for directories. +Patch0: change__file__report-dir.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module flaky} BuildRequires: %{python_module hypothesis >= 4.57}