From 2f15c7670fca3d71a18296bd137b538152318592 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 13 Nov 2019 10:19:33 +0100 Subject: [PATCH] dev-python/mock: Fix tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Switch to GitHub to get tests. Remove absurd test deps. Run tests via unittest to avoid compatibility problems with installed mock. Signed-off-by: Michał Górny --- dev-python/mock/Manifest | 2 +- dev-python/mock/mock-3.0.5-r1.ebuild | 48 ++++++++++++++++++++++++++++ dev-python/mock/mock-3.0.5.ebuild | 40 ----------------------- 3 files changed, 49 insertions(+), 41 deletions(-) create mode 100644 dev-python/mock/mock-3.0.5-r1.ebuild delete mode 100644 dev-python/mock/mock-3.0.5.ebuild diff --git a/dev-python/mock/Manifest b/dev-python/mock/Manifest index ded8619cac20..d8ae973f1c4e 100644 --- a/dev-python/mock/Manifest +++ b/dev-python/mock/Manifest @@ -1,4 +1,4 @@ DIST mock-1.0.1.tar.gz 818644 BLAKE2B 7bfe02c413c2f98a2d98ca9cc40ca8831d65b3a5095d95625e0844e764c3510b771dc9e36086dd44f518659cdf7f1d105c02bdb51c5ffe00953c5eb3b0e05106 SHA512 4f6f4ebc34843e16b15d866e415ad9992e79bd266a63a22fee31b773ba77615e3406bc8890ceed92c0ee296380d68c46299c4c4448a3526f9cb96b258d32cf58 DIST mock-1.3.0.tar.gz 70908 BLAKE2B 4df669c5d54fc835c70d6190362d4dea9cc0d2e7ca47f6ef5a394bc80cac10898b611146f28da93e84c4b26c23f25708be3c8fc6b61062dae099396e351861d8 SHA512 10cbb78b89f2e82abfcadc035a526182f83b59df4775cd85acfdbeb4505791c63b7a3761e6126a08d9aedbd07ead8632ac2a728dc07a362f4aaeea694bdecaf9 DIST mock-2.0.0.tar.gz 73684 BLAKE2B 970bebe72b6969b58acdc2856b53054f992d01f9f3ca5f91b73073d0a1c9ec89a5c94fd66eab85b258f23f33326825ff6598bb2ba8e07eded1e6540a26ac5fa3 SHA512 a08007651b749d2843b94f5045d74c122958888290aea21930455538a854e6b04c07115e21d82edde996154bf597d7a8784a2f4213cbabc49a98dec22dd92238 -DIST mock-3.0.5.tar.gz 28126 BLAKE2B 8006beac0b0f6b120298c223bfea159da46abf594cbda3636bc4c04f9effaddc503e0ccc3804c2c070b74d4f1e751fee5bfa839a7591bac855b8aa00563cec7f SHA512 536ab1f0f1448373e9d75e43c6fdb0434adacf0d2cf6eecfe7e590b096c7314914d8e5c20211f196abc59ecb88eb0bf902ae01e7b06d6892e7c0be9d4e35a049 +DIST mock-3.0.5.gh.tar.gz 67887 BLAKE2B b9c49b3627275889d73aff9ea9c7925093f9cafb304448b2f06eda2fff26152a031aafb4844537e4d58bc112709e59a44e08d32602776386a30d039743def29c SHA512 9ab4f0c794f5701ba1367d982cf79a5662d4233753d12ed9c88ae20282db1f44be73f84c4d9f6d03ff64926b8c1b6d0c9a79b2a4724a3eb36c247ffd4ab03e2d diff --git a/dev-python/mock/mock-3.0.5-r1.ebuild b/dev-python/mock/mock-3.0.5-r1.ebuild new file mode 100644 index 000000000000..657e0a3c7cd1 --- /dev/null +++ b/dev-python/mock/mock-3.0.5-r1.ebuild @@ -0,0 +1,48 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +PYTHON_COMPAT=( python2_7 python3_{5,6,7} pypy pypy3 ) + +inherit distutils-r1 + +DESCRIPTION="Rolling backport of unittest.mock for all Pythons" +HOMEPAGE="https://github.com/testing-cabal/mock" +SRC_URI="https://github.com/testing-cabal/mock/archive/${PV}.tar.gz -> ${P}.gh.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos" + +RDEPEND=" + >=virtual/python-funcsigs-1[${PYTHON_USEDEP}] + >=dev-python/six-1.9[${PYTHON_USEDEP}]" +DEPEND="${RDEPEND} + >=dev-python/setuptools-17.1[${PYTHON_USEDEP}]" + +python_test() { + # Upstream supports running tests only in their dream pristine + # environment. pytest doesn't work at all if mock is already + # installed. We can use plain unittest but we have to reinvent + # test filtering. + cp -r mock/tests "${BUILD_DIR}"/lib/mock/ || die + cd "${BUILD_DIR}"/lib || die + if ! python_is_python3; then + rm mock/tests/*py3* || die + fi + + # https://github.com/testing-cabal/mock/commit/d6b42149bb87cf38729eef8a100c473f602ef7fa + if [[ ${EPYTHON} == pypy* ]]; then + sed -i -e 's:def test_copy:def _test_copy:' \ + mock/tests/testmock.py || die + fi + + "${EPYTHON}" -m unittest discover -v || die "Tests failed with ${EPYTHON}" +} + +python_install_all() { + local DOCS=( CHANGELOG.rst README.rst ) + + distutils-r1_python_install_all +} diff --git a/dev-python/mock/mock-3.0.5.ebuild b/dev-python/mock/mock-3.0.5.ebuild deleted file mode 100644 index fd2c6df91895..000000000000 --- a/dev-python/mock/mock-3.0.5.ebuild +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright 1999-2019 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 - -PYTHON_COMPAT=( python2_7 python3_{5,6,7} pypy pypy3 ) - -inherit distutils-r1 - -DESCRIPTION="Rolling backport of unittest.mock for all Pythons" -HOMEPAGE="https://github.com/testing-cabal/mock" -SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" - -LICENSE="BSD" -SLOT="0" -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos" -IUSE="test" - -RDEPEND=" - >=virtual/python-funcsigs-1[${PYTHON_USEDEP}] - >=dev-python/six-1.9[${PYTHON_USEDEP}]" -DEPEND="${RDEPEND} - >=dev-python/setuptools-17.1[${PYTHON_USEDEP}] - test? ( - dev-python/nose[${PYTHON_USEDEP}] - dev-python/pytest-cov[${PYTHON_USEDEP}] - >=dev-python/unittest2-1.1.0[${PYTHON_USEDEP}] - )" - -RESTRICT="!test? ( test )" - -python_test() { - nosetests --verbose || die "tests fail under ${EPYTHON}" -} - -python_install_all() { - local DOCS=( CHANGELOG.rst README.rst ) - - distutils-r1_python_install_all -} -- 2.26.2