Blame SOURCES/fix-mock-python-3.8.patch

07645c
From b2683fdfc2fbd67dfc14bfc8e9d2c06530975397 Mon Sep 17 00:00:00 2001
07645c
From: Bruno Oliveira <bruno@esss.com.br>
07645c
Date: Fri, 3 May 2019 08:58:31 -0300
07645c
Subject: [PATCH] Fix tests due to new formatting in mock 3.0 and python 3.8
07645c
07645c
---
07645c
 test_pytest_mock.py | 10 +++++-----
07645c
 1 file changed, 5 insertions(+), 5 deletions(-)
07645c
07645c
diff --git a/test_pytest_mock.py b/test_pytest_mock.py
07645c
index 7bc38cb..562ff0c 100644
07645c
--- a/test_pytest_mock.py
07645c
+++ b/test_pytest_mock.py
07645c
@@ -10,11 +10,11 @@
07645c
 
07645c
 # could not make some of the tests work on PyPy, patches are welcome!
07645c
 skip_pypy = pytest.mark.skipif(
07645c
-    platform.python_implementation() == "PyPy", reason="could not make work on pypy"
07645c
+    platform.python_implementation() == "PyPy", reason="could not make it work on pypy"
07645c
 )
07645c
 
07645c
-# Python 3.8 changed the output formatting (bpo-35500).
07645c
-PY38 = sys.version_info >= (3, 8)
07645c
+# Python 3.8 changed the output formatting (bpo-35500), which has been ported to mock 3.0
07645c
+NEW_FORMATTING = sys.version_info >= (3, 8) or sys.version_info[0] == 2
07645c
 
07645c
 
07645c
 @pytest.fixture
07645c
@@ -209,7 +209,7 @@ def test_repr_with_name(self, mocker):
07645c
 
07645c
     def __test_failure_message(self, mocker, **kwargs):
07645c
         expected_name = kwargs.get("name") or "mock"
07645c
-        if PY38:
07645c
+        if NEW_FORMATTING:
07645c
             msg = "expected call not found.\nExpected: {0}()\nActual: not called."
07645c
         else:
07645c
             msg = "Expected call: {0}()\nNot called"
07645c
@@ -620,7 +620,7 @@ def test(mocker):
07645c
     """
07645c
     )
07645c
     result = testdir.runpytest("-s")
07645c
-    if PY38:
07645c
+    if NEW_FORMATTING:
07645c
         expected_lines = [
07645c
             "*AssertionError: expected call not found.",
07645c
             "*Expected: mock('', bar=4)",