1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 python3_{6,7,8} pypy3 )
10 DESCRIPTION="Rolling backport of unittest.mock for all Pythons"
11 HOMEPAGE="https://github.com/testing-cabal/mock"
12 SRC_URI="https://github.com/testing-cabal/mock/archive/${PV}.tar.gz -> ${P}.gh.tar.gz"
16 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos"
19 >=virtual/python-funcsigs-1[${PYTHON_USEDEP}]
20 >=dev-python/six-1.9[${PYTHON_USEDEP}]"
22 >=dev-python/setuptools-17.1[${PYTHON_USEDEP}]"
25 # Upstream supports running tests only in their dream pristine
26 # environment. pytest doesn't work at all if mock is already
27 # installed. We can use plain unittest but we have to reinvent
29 cp -r mock/tests "${BUILD_DIR}"/lib/mock/ || die
30 cd "${BUILD_DIR}"/lib || die
31 if ! python_is_python3; then
32 rm mock/tests/*py3* || die
35 # https://github.com/testing-cabal/mock/commit/d6b42149bb87cf38729eef8a100c473f602ef7fa
36 if [[ ${EPYTHON} == pypy* ]]; then
37 sed -i -e 's:def test_copy:def _test_copy:' \
38 mock/tests/testmock.py || die
41 "${EPYTHON}" -m unittest discover -v || die "Tests failed with ${EPYTHON}"
44 python_install_all() {
45 local DOCS=( CHANGELOG.rst README.rst )
47 distutils-r1_python_install_all