forked from pool/python-flake8
- Add patch to fix build with pytest 6:
* pytest6.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8?expand=0&rev=67
This commit is contained in:
parent
1c6d8b60ef
commit
e4b944acc3
46
pytest6.patch
Normal file
46
pytest6.patch
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
From 91b09d5b376cfb8afd4b6af5b407f57aa42011c7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
|
||||||
|
Date: Mon, 20 Jul 2020 13:18:23 +0200
|
||||||
|
Subject: [PATCH] Tests: Add a value to mocked entry_points, so pytest 6+ can
|
||||||
|
log it
|
||||||
|
|
||||||
|
Pytest 6.0.0rc1 attempts to log a repr of our mocked entry_point,
|
||||||
|
but it fails, becasue the repr metohod expects a valua attribute:
|
||||||
|
|
||||||
|
Reproducer:
|
||||||
|
|
||||||
|
$ tox -e py38 --force-dep 'pytest==6.0.0rc1'
|
||||||
|
...
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "/usr/lib/python3.8/logging/__init__.py", line 1081, in emit
|
||||||
|
msg = self.format(record)
|
||||||
|
File "/usr/lib/python3.8/logging/__init__.py", line 925, in format
|
||||||
|
return fmt.format(record)
|
||||||
|
File "/usr/lib/python3.8/logging/__init__.py", line 664, in format
|
||||||
|
record.message = record.getMessage()
|
||||||
|
File "/usr/lib/python3.8/logging/__init__.py", line 369, in getMessage
|
||||||
|
msg = msg % self.args
|
||||||
|
File "/tmp/flake8/.tox/py38/lib/python3.8/site-packages/flake8/plugins/manager.py", line 44, in __repr__
|
||||||
|
self.name, self.entry_point.value
|
||||||
|
File "/tmp/flake8/.tox/py38/lib/python3.8/site-packages/mock/mock.py", line 632, in __getattr__
|
||||||
|
raise AttributeError("Mock object has no attribute %r" % name)
|
||||||
|
AttributeError: Mock object has no attribute 'value'
|
||||||
|
---
|
||||||
|
tests/integration/test_checker.py | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/tests/integration/test_checker.py b/tests/integration/test_checker.py
|
||||||
|
index eaab5c3..0acdb6e 100644
|
||||||
|
--- a/tests/integration/test_checker.py
|
||||||
|
+++ b/tests/integration/test_checker.py
|
||||||
|
@@ -100,6 +100,7 @@ def mock_file_checker_with_plugin(plugin_target):
|
||||||
|
entry_point = mock.Mock(spec=['load'])
|
||||||
|
entry_point.name = plugin_target.name
|
||||||
|
entry_point.load.return_value = plugin_target
|
||||||
|
+ entry_point.value = 'mocked:value'
|
||||||
|
|
||||||
|
# Load the checker plugins using the entry point mock
|
||||||
|
with mock.patch.object(
|
||||||
|
--
|
||||||
|
GitLab
|
||||||
|
|
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Aug 31 10:20:01 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
|
||||||
|
|
||||||
|
- Add patch to fix build with pytest 6:
|
||||||
|
* pytest6.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sat Jul 11 19:09:03 UTC 2020 - Arun Persaud <arun@gmx.de>
|
Sat Jul 11 19:09:03 UTC 2020 - Arun Persaud <arun@gmx.de>
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ License: MIT
|
|||||||
URL: https://gitlab.com/pycqa/flake8
|
URL: https://gitlab.com/pycqa/flake8
|
||||||
Source: https://files.pythonhosted.org/packages/source/f/flake8/flake8-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/f/flake8/flake8-%{version}.tar.gz
|
||||||
Patch0: fix-mock-patch-with-python3.4.patch
|
Patch0: fix-mock-patch-with-python3.4.patch
|
||||||
|
Patch1: pytest6.patch
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
|
Loading…
Reference in New Issue
Block a user