Blame SOURCES/32d8c0665ea044f9682a89633d75442d1a4d2dc4.patch

rdobuilder aa0fa8
From 32d8c0665ea044f9682a89633d75442d1a4d2dc4 Mon Sep 17 00:00:00 2001
rdobuilder aa0fa8
From: Ned Batchelder <ned@nedbatchelder.com>
rdobuilder aa0fa8
Date: Thu, 5 Dec 2019 16:37:48 -0500
rdobuilder aa0fa8
Subject: [PATCH] Fix the context tests
rdobuilder aa0fa8
rdobuilder aa0fa8
CoverageData.lines() returns a list, but in no guaranteed order.
rdobuilder aa0fa8
Set-ify everything to get the correct comparison.
rdobuilder aa0fa8
---
rdobuilder aa0fa8
 tests/test_pytest_cov.py | 6 +++---
rdobuilder aa0fa8
 1 file changed, 3 insertions(+), 3 deletions(-)
rdobuilder aa0fa8
rdobuilder aa0fa8
diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py
rdobuilder aa0fa8
index e79e9aa..3be8278 100644
rdobuilder aa0fa8
--- a/tests/test_pytest_cov.py
rdobuilder aa0fa8
+++ b/tests/test_pytest_cov.py
rdobuilder aa0fa8
@@ -1934,12 +1934,12 @@ def test_cov_and_no_cov(testdir):
rdobuilder aa0fa8
 
rdobuilder aa0fa8
 
rdobuilder aa0fa8
 def find_labels(text, pattern):
rdobuilder aa0fa8
-    all_labels = collections.defaultdict(list)
rdobuilder aa0fa8
+    all_labels = collections.defaultdict(set)
rdobuilder aa0fa8
     lines = text.splitlines()
rdobuilder aa0fa8
     for lineno, line in enumerate(lines, start=1):
rdobuilder aa0fa8
         labels = re.findall(pattern, line)
rdobuilder aa0fa8
         for label in labels:
rdobuilder aa0fa8
-            all_labels[label].append(lineno)
rdobuilder aa0fa8
+            all_labels[label].add(lineno)
rdobuilder aa0fa8
     return all_labels
rdobuilder aa0fa8
 
rdobuilder aa0fa8
 
rdobuilder aa0fa8
@@ -2007,7 +2007,7 @@ def test_contexts(testdir, opts):
rdobuilder aa0fa8
         if context == '':
rdobuilder aa0fa8
             continue
rdobuilder aa0fa8
         data.set_query_context(context)
rdobuilder aa0fa8
-        actual = data.lines(test_context_path)
rdobuilder aa0fa8
+        actual = set(data.lines(test_context_path))
rdobuilder aa0fa8
         assert line_data[label] == actual, "Wrong lines for context {!r}".format(context)
rdobuilder aa0fa8
 
rdobuilder aa0fa8