diff options
-rw-r--r-- | dev-python/flake8/Manifest | 1 | ||||
-rw-r--r-- | dev-python/flake8/files/flake8-3.8.3-pytest6.patch | 40 | ||||
-rw-r--r-- | dev-python/flake8/flake8-3.8.3.ebuild | 47 |
3 files changed, 88 insertions, 0 deletions
diff --git a/dev-python/flake8/Manifest b/dev-python/flake8/Manifest index ef65d6c22b09..26713f2ebbca 100644 --- a/dev-python/flake8/Manifest +++ b/dev-python/flake8/Manifest @@ -1 +1,2 @@ DIST flake8-3.8.1.tar.gz 157166 BLAKE2B cc8b2dc11f78a6b9c62662086cc190a29a0a4e5a228d4823de8e2f3f327cea3e5df4db220faf9cc14fa34e3825b7d1e4fc4ccf9d1205b437903f327f3ebfa7bb SHA512 f73a306be7d8e5bc48dd9d6d8f8cdee07a90c6c38ee7bd37a21f4be23f1812e4a1e214cc75ca1a324f40e750312b5d7ed573ff49d673f9a1f33aad188b108add +DIST flake8-3.8.3.tar.gz 162305 BLAKE2B 7211c9ff99ce2e8e3094e6a7a1917ee1b3d61902a45408b9c84f077097af8d1b0571e27209ed78409c9931ff53fdb660f81d1886773b8ef74ceb0bd3de60420c SHA512 007158ea5caf60ff84e935f1b74a5f746fba00991c8808395ff72126dc1a8c8e135badc6f1f383027349076b8f3e146e9d0af27b6e24cdf97390463fd69ad940 diff --git a/dev-python/flake8/files/flake8-3.8.3-pytest6.patch b/dev-python/flake8/files/flake8-3.8.3-pytest6.patch new file mode 100644 index 000000000000..78e7391d0379 --- /dev/null +++ b/dev-python/flake8/files/flake8-3.8.3-pytest6.patch @@ -0,0 +1,40 @@ +commit 91b09d5b376cfb8afd4b6af5b407f57aa42011c7 +Author: Miro Hrončok <miro@hroncok.cz> +Date: Mon Jul 20 13:18:23 2020 +0200 + + 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' + +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( diff --git a/dev-python/flake8/flake8-3.8.3.ebuild b/dev-python/flake8/flake8-3.8.3.ebuild new file mode 100644 index 000000000000..7fb88e57ff18 --- /dev/null +++ b/dev-python/flake8/flake8-3.8.3.ebuild @@ -0,0 +1,47 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( pypy3 python3_{6..8} ) +DISTUTILS_USE_SETUPTOOLS=rdepend + +inherit distutils-r1 + +DESCRIPTION="A wrapper around PyFlakes, pep8 & mccabe" +HOMEPAGE="https://gitlab.com/pycqa/flake8 https://pypi.org/project/flake8/" +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~s390 ~x86" + +# requires.txt inc. mccabe however that creates a circular dep +RDEPEND=" + >=dev-python/pyflakes-2.2.0[${PYTHON_USEDEP}] + <dev-python/pyflakes-2.3.0[${PYTHON_USEDEP}] + >=dev-python/pycodestyle-2.6.0[${PYTHON_USEDEP}] + <dev-python/pycodestyle-2.7.0[${PYTHON_USEDEP}] + dev-python/importlib_metadata[${PYTHON_USEDEP}] +" +PDEPEND=" + >=dev-python/mccabe-0.6.0[${PYTHON_USEDEP}] + <dev-python/mccabe-0.7.0[${PYTHON_USEDEP}] +" +BDEPEND="${RDEPEND} + test? ( + ${PDEPEND} + >=dev-python/mock-2.0.0[${PYTHON_USEDEP}] + ) +" + +PATCHES=( "${FILESDIR}/${P}-pytest6.patch" ) + +distutils_enable_sphinx docs/source dev-python/sphinx-prompt dev-python/sphinx_rtd_theme +distutils_enable_tests pytest + +python_test() { + # Otherwise some tests fail if the package isn't installed + distutils_install_for_testing + pytest -vv || die "Tests fail with ${EPYTHON}" +} |