Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 597708 - dev-python/pytest-cov-2.3.1 fails tests - pytest.py: error: unrecognized arguments: --cov=/var/tmp/portage/dev-python/pytest-cov-2.3.1/temp/pytest-of-portage/pytest-0/testdir/test_central0 --cov-report=term-missing
Summary: dev-python/pytest-cov-2.3.1 fails tests - pytest.py: error: unrecognized argu...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Patrick McLean
URL:
Whiteboard:
Keywords: TESTFAILURE
: 623308 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-10-21 15:55 UTC by eroen
Modified: 2019-05-01 02:01 UTC (History)
8 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,10.54 KB, text/plain)
2016-10-21 15:55 UTC, eroen
Details
pytest-cov-2.3.1: Install package for test suite & mark some tests as XFAIL (pytest-2.3.1-Fix_test_suite.patch,1.62 KB, patch)
2017-07-22 06:29 UTC, Maram
Details | Diff
emerge-info.txt (emerge-info.txt,16.91 KB, text/plain)
2017-10-29 08:49 UTC, Toralf Förster
Details
dev-python:pytest-cov-2.5.1:20171028-212903.log (dev-python:pytest-cov-2.5.1:20171028-212903.log,9.42 KB, text/plain)
2017-10-29 08:49 UTC, Toralf Förster
Details
emerge-history.txt (emerge-history.txt,244.44 KB, text/plain)
2017-10-29 08:49 UTC, Toralf Förster
Details
environment (environment,112.13 KB, text/plain)
2017-10-29 08:49 UTC, Toralf Förster
Details
etc.portage.tbz2 (etc.portage.tbz2,15.57 KB, application/x-bzip)
2017-10-29 08:49 UTC, Toralf Förster
Details
temp.tbz2 (temp.tbz2,27.18 KB, application/x-bzip)
2017-10-29 08:49 UTC, Toralf Förster
Details
tests.tbz2 (tests.tbz2,5.59 KB, application/x-bzip)
2017-10-29 08:49 UTC, Toralf Förster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description eroen 2016-10-21 15:55:25 UTC
Created attachment 450922 [details]
build.log

=================================== FAILURES ===================================
_________________________________ test_central _________________________________
../../../../../work/pytest-cov-2.3.1/tests/test_pytest_cov.py:178: in test_central
    '*10 passed*'
E   Failed: remains unmatched: '*- coverage: platform *, python * -*', see stderr
----------------------------- Captured stdout call -----------------------------
running: /usr/bin/python2.7 /usr/lib64/python2.7/site-packages/pytest.py --basetemp=/var/tmp/portage/dev-python/pytest-cov-2.3.1/temp/pytest-of-portage/pytest-0/testdir/test_central0/runpytest-0 -v --cov=/var/tmp/portage/dev-python/pytest-cov-2.3.1/temp/pytest-of-portage/pytest-0/testdir/test_central0 --cov-report=term-missing /var/tmp/portage/dev-python/pytest-cov-2.3.1/temp/pytest-of-portage/pytest-0/testdir/test_central0/test_central.py --basetemp=/var/tmp/portage/dev-python/pytest-cov-2.3.1/temp/pytest-of-portage/pytest-0/testdir/basetemp
     in: /var/tmp/portage/dev-python/pytest-cov-2.3.1/temp/pytest-of-portage/pytest-0/testdir/test_central0
----------------------------- Captured stderr call -----------------------------
usage: pytest.py [options] [file_or_dir] [file_or_dir] [...]
pytest.py: error: unrecognized arguments: --cov=/var/tmp/portage/dev-python/pytest-cov-2.3.1/temp/pytest-of-portage/pytest-0/testdir/test_central0 --cov-report=term-missing
  inifile: None
  rootdir: /var/tmp/portage/dev-python/pytest-cov-2.3.1/temp/pytest-of-portage/pytest-0/testdir/test_central0
============================ pytest-warning summary ============================
WI1 /usr/lib64/python2.7/site-packages/pytest_capturelog.py:171 'pytest_runtest_makereport' hook uses deprecated __multicall__ argument
!!!!!!!!!!!!!!!!!!!! Interrupted: stopping after 1 failures !!!!!!!!!!!!!!!!!!!!
=========== 1 failed, 11 skipped, 1 pytest-warnings in 0.71 seconds ============
 * ERROR: dev-python/pytest-cov-2.3.1::gentoo failed (test phase):
 *   Tests failed under python2.7
 * 
 * Call stack:
 *     ebuild.sh, line  115:  Called src_test
 *   environment, line 2634:  Called distutils-r1_src_test
 *   environment, line  829:  Called _distutils-r1_run_foreach_impl 'python_test'
 *   environment, line  308:  Called python_foreach_impl 'distutils-r1_run_phase' 'python_test'
 *   environment, line 2148:  Called multibuild_foreach_variant '_python_multibuild_wrapper' 'distutils-r1_run_phase' 'python_test'
 *   environment, line 1452:  Called _multibuild_run '_python_multibuild_wrapper' 'distutils-r1_run_phase' 'python_test'
 *   environment, line 1450:  Called _python_multibuild_wrapper 'distutils-r1_run_phase' 'python_test'
 *   environment, line  520:  Called distutils-r1_run_phase 'python_test'
 *   environment, line  761:  Called python_test
 *   environment, line 2513:  Called die
 * The specific snippet of code:
 *       PYTHONPATH="${S}/tests:${BUILD_DIR}/lib" PYTEST_PLUGINS=${PN/-/_} py.test -v -v -x || die "Tests failed under ${EPYTHON}"
Comment 1 eroen 2016-10-21 16:05:09 UTC
localhost ~ # emerge --info '=dev-python/pytest-cov-2.3.1::gentoo'
Portage 2.3.0 (python 3.4.3-final-0, default/linux/amd64/13.0, gcc-4.9.3, glibc-2.22-r4, 4.4.6-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.4.6-gentoo-x86_64-Intel-R-_Core-TM-_i5-2520M_CPU_@_2.50GHz-with-gentoo-2.2
KiB Mem:     4043380 total,   3799344 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Fri, 21 Oct 2016 00:45:01 +0000
sh bash 4.3_p48
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p48::gentoo
dev-lang/perl:            5.22.2::gentoo
dev-lang/python:          2.7.10-r1::gentoo, 3.4.3-r1::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.21.7::gentoo
sys-apps/sandbox:         2.10-r1::gentoo
sys-devel/autoconf:       2.69::gentoo
sys-devel/automake:       1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.9.3::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.3::gentoo (virtual/os-headers)
sys-libs/glibc:           2.22-r4::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS=""
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="acl amd64 berkdb bindist bzip2 cli cracklib crypt cxx dri fortran gdbm iconv ipv6 mmx mmxext modules multilib ncurses nls nptl openmp pam pcre readline seccomp session sse sse2 ssl tcpd unicode xattr zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby20 ruby21" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

localhost ~ # emerge -pqv '=dev-python/pytest-cov-2.3.1::gentoo'
[ebuild  N    ] dev-python/pytest-cov-2.3.1  USE="{test} -doc" PYTHON_TARGETS="python2_7 python3_4 -pypy -python3_5" 

 * IMPORTANT: 11 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.
Comment 2 Pacho Ramos gentoo-dev 2017-07-03 09:39:52 UTC
*** Bug 623308 has been marked as a duplicate of this bug. ***
Comment 3 Maram 2017-07-22 06:29:38 UTC
Created attachment 486418 [details, diff]
pytest-cov-2.3.1: Install package for test suite & mark some tests as XFAIL

It seems as the pytest-cov plugin needs to be installed correctly before it can be used in the test suite (i.e. before pytest recognizes the --cov argument).
We can invoke distutils_install_for_testing to accomplish that. The following works for me

    python_test() {
        distutils_install_for_testing
        PYTHONPATH="${S}/tests:${BUILD_DIR}/lib:${PYTHONPATH}" \
            py.test -v -v -x || die "Tests failed under ${EPYTHON}" 
    }


Note that distutils_install_for_testing adjusts PYTHONPATH, so we have to keep its modification when altering PYTHONPATH.

However, the test suite still does not pass. Two tests are failing

* The test test_central_subprocess_change_cwd_with_pythonpath fails (as the name might suggest) because it tampers with PYTHONPATH and the modifications of distutils_install_for_testing are lost.

* The test test_dist_missing_data fails due to the feature network-sandbox. (It tries to query some pip infos from the net which is not so obvious from the code).

Here is a snippet which markes those two tests as XFAIL:

    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
    }

P.S. feel free to consider the failure of test_dist_missing_data to be not part of this bug report
Comment 4 Toralf Förster gentoo-dev 2017-10-29 08:49:08 UTC
appeared recently at the tinderbox image 17.0-no-multilib_libressl-test_20171022-133742
Comment 5 Toralf Förster gentoo-dev 2017-10-29 08:49:11 UTC
Created attachment 500726 [details]
emerge-info.txt
Comment 6 Toralf Förster gentoo-dev 2017-10-29 08:49:15 UTC
Created attachment 500728 [details]
dev-python:pytest-cov-2.5.1:20171028-212903.log
Comment 7 Toralf Förster gentoo-dev 2017-10-29 08:49:18 UTC
Created attachment 500730 [details]
emerge-history.txt
Comment 8 Toralf Förster gentoo-dev 2017-10-29 08:49:21 UTC
Created attachment 500732 [details]
environment
Comment 9 Toralf Förster gentoo-dev 2017-10-29 08:49:24 UTC
Created attachment 500734 [details]
etc.portage.tbz2
Comment 10 Toralf Förster gentoo-dev 2017-10-29 08:49:27 UTC
Created attachment 500736 [details]
temp.tbz2
Comment 11 Toralf Förster gentoo-dev 2017-10-29 08:49:30 UTC
Created attachment 500738 [details]
tests.tbz2
Comment 12 Virgil Dupras (RETIRED) gentoo-dev 2019-04-12 13:21:06 UTC
maram: better late than never. your suggestion works, thanks. Applying.

I also get the same failures as you on those two tests. I'll mask them for now, which is much better than what we have.
Comment 13 Larry the Git Cow gentoo-dev 2019-04-12 13:35:07 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f6865fd5a614dcf9346addf503cbc0b8b446acbf

commit f6865fd5a614dcf9346addf503cbc0b8b446acbf
Author:     Virgil Dupras <vdupras@gentoo.org>
AuthorDate: 2019-04-12 13:34:56 +0000
Commit:     Virgil Dupras <vdupras@gentoo.org>
CommitDate: 2019-04-12 13:34:56 +0000

    dev-python/pytest-cov: bump to 2.6.1
    
    Also, fix broken tests.
    
    Bug: https://bugs.gentoo.org/597708
    Signed-off-by: Virgil Dupras <vdupras@gentoo.org>
    Package-Manager: Portage-2.3.62, Repoman-2.3.11

 dev-python/pytest-cov/Manifest                     |  1 +
 .../pytest-cov-2.6.1-disable-broken-tests.patch    | 22 +++++++++
 dev-python/pytest-cov/pytest-cov-2.6.1.ebuild      | 57 ++++++++++++++++++++++
 3 files changed, 80 insertions(+)
Comment 14 Maram 2019-04-13 11:03:22 UTC
@Virgil: You're welcome. Thanks for looking into this issue.