#4 Fix context tests
Closed 4 years ago by chedi. Opened 4 years ago by cstratak.
rpms/ cstratak/python-pytest-cov fix-context-test  into  master

@@ -0,0 +1,28 @@ 

+ diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py

+ index e79e9aa..3be8278 100644

+ --- a/tests/test_pytest_cov.py

+ +++ b/tests/test_pytest_cov.py

+ @@ -1934,12 +1934,12 @@ def test_cov_and_no_cov(testdir):

+  

+  

+  def find_labels(text, pattern):

+ -    all_labels = collections.defaultdict(list)

+ +    all_labels = collections.defaultdict(set)

+      lines = text.splitlines()

+      for lineno, line in enumerate(lines, start=1):

+          labels = re.findall(pattern, line)

+          for label in labels:

+ -            all_labels[label].append(lineno)

+ +            all_labels[label].add(lineno)

+      return all_labels

+  

+  

+ @@ -2007,7 +2007,7 @@ def test_contexts(testdir, opts):

+          if context == '':

+              continue

+          data.set_query_context(context)

+ -        actual = data.lines(test_context_path)

+ +        actual = set(data.lines(test_context_path))

+          assert line_data[label] == actual, "Wrong lines for context {!r}".format(context)

+  

+  

file modified
+9 -1
@@ -9,13 +9,17 @@ 

  

  Name:           python-%{srcname}

  Version:        2.8.1

- Release:        2%{?dist}

+ Release:        3%{?dist}

  Summary:        Pytest plugin for coverage reporting

  

  License:        MIT

  URL:            https://pypi.python.org/pypi/%{srcname}

  Source0:        https://github.com/pytest-dev/%{srcname}/archive/v%{version}/%{srcname}-%{version}.tar.gz

  

+ # Fix some context tests that were failing with the newest python-coverage

+ # Fixed upstream: https://github.com/pytest-dev/pytest-cov/pull/370

+ Patch0:         fix-context-tests.patch

+ 

  BuildArch:      noarch

  

  %description
@@ -66,6 +70,7 @@ 

  

  %prep

  %setup -q -n %{srcname}-%{version}

+ %patch0 -p1

  rm -rf *.egg-info

  

  
@@ -111,6 +116,9 @@ 

  

  

  %changelog

+ * Wed Jan 08 2020 Charalampos Stratakis <cstratak@redhat.com> - 2.8.1-3

+ - Fix context tests

+ 

  * Sun Nov  3 2019 Orion Poplawski <orion@nwra.com> - 2.8.1-2

  - Drop python 2 for F32+ (bz#1767517)

  

no initial comment

Sorry I missed this. Care to rebase it?

closing this pull request as the patch is already integrated

Pull-Request has been closed by chedi

4 years ago