dev-python/pytest-cov-2.3.1: Fix test suite failure Install the package properly for testing with distutils_install_for_testing. Disable tests which still fail. These are: * test_central_subprocess_change_cwd_with_pythonpath, because it tampers with PYTHONPATH (which was adjusted by distutils_install_for_testing). * test_dist_missing_data, because it tries to access the internet which fails when the feature network-sandbox is enabled. diff -ur a/dev-python/pytest-cov/pytest-cov-2.3.1.ebuild b/dev-python/pytest-cov/pytest-cov-2.3.1.ebuild --- a/dev-python/pytest-cov/pytest-cov-2.3.1.ebuild +++ b/dev-python/pytest-cov/pytest-cov-2.3.1.ebuild @@ -44,13 +44,26 @@ PATCHES=( "${FILESDIR}/fix-for-deprecation-warnings.patch" ) +src_prepare() { + default + + # Mark tests which tamper with PYTHONPATH with xfail since they will fail + # inside a portage build. Bug #597708 + # Also mark tests which need internet access (which fails with feature + # network-sandbox enabled). + sed -i \ + -e '/^def test_central_subprocess_change_cwd_with_pythonpath/ i\@pytest.mark.xfail(reason="Changing PYTHONPATH causes trouble inside of an emerge process")' \ + -e '/^def test_dist_missing_data/ i\@pytest.mark.xfail(reason="internet access fails with feature network-sandbox enabled")' \ + tests/test_pytest_cov.py +} + python_compile_all() { use doc && sphinx-build -b html docs _build/html } python_test() { - PYTHONPATH="${S}/tests:${BUILD_DIR}/lib" \ - PYTEST_PLUGINS=${PN/-/_} \ + distutils_install_for_testing + PYTHONPATH="${S}/tests:${BUILD_DIR}/lib:${PYTHONPATH}" \ py.test -v -v -x || die "Tests failed under ${EPYTHON}" }