Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 603742 - dev-python/tox-1.8.0 fails test-suite due to missing executable "tox"
Summary: dev-python/tox-1.8.0 fails test-suite due to missing executable "tox"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords: TESTFAILURE
: 623294 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-12-26 10:10 UTC by Maram
Modified: 2018-08-18 06:15 UTC (History)
3 users (show)

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


Attachments
Skip test which need the 'tox' executable installed (tox-2.4.1-Skip_cmdline_tests.patch,1.45 KB, patch)
2017-02-18 10:12 UTC, Maram
Details | Diff
Patch for the tox ebuild to apply above patch (tox-2.4.1.ebuild-Skip-tests-which-need-the-tox-executable.patch,860 bytes, patch)
2017-02-18 10:13 UTC, Maram
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maram 2016-12-26 10:10:36 UTC
dev-python/tox-1.8.1 and dev-python/tox-1.8.0 fail their test-suite with

[...]
tests/test_config.py ....................................................................................................FFFFFF............s
tests/test_interpreters.py s........
tests/test_quickstart.py .............
tests/test_result.py ...
tests/test_venv.py ..................s...................
tests/test_z_cmdline.py ........FFFFFFFFFFFFFFFFFFFF..F
======================================== short test summary info ========================================
SKIP [1] tests/test_interpreters.py:10: condition: sys.platform != 'win32'
SKIP [1] /var/tmp/portage/dev-python/tox-1.8.1/work/tox-1.8.1/tests/test_venv.py:318: needs python3.3
SKIP [1] tests/test_config.py:1445: condition: sys.platform != 'win32'
FAIL tests/test_config.py::TestCmdInvocation::()::test_help
FAIL tests/test_config.py::TestCmdInvocation::()::test_version
FAIL tests/test_config.py::TestCmdInvocation::()::test_listenvs
FAIL tests/test_config.py::TestCmdInvocation::()::test_config_specific_ini
FAIL tests/test_config.py::TestCmdInvocation::()::test_no_tox_ini
FAIL tests/test_config.py::TestCmdInvocation::()::test_showconfig_with_force_dep_version
FAIL tests/test_z_cmdline.py::test_minversion
FAIL tests/test_z_cmdline.py::test_run_custom_install_command_error
FAIL tests/test_z_cmdline.py::test_unknown_interpreter_and_env
FAIL tests/test_z_cmdline.py::test_unknown_interpreter
FAIL tests/test_z_cmdline.py::test_skip_unknown_interpreter
FAIL tests/test_z_cmdline.py::test_unknown_dep
FAIL tests/test_z_cmdline.py::test_unknown_environment
FAIL tests/test_z_cmdline.py::test_skip_sdist
FAIL tests/test_z_cmdline.py::test_minimal_setup_py_empty
FAIL tests/test_z_cmdline.py::test_minimal_setup_py_comment_only
FAIL tests/test_z_cmdline.py::test_minimal_setup_py_non_functional
FAIL tests/test_z_cmdline.py::test_sdist_fails
FAIL tests/test_z_cmdline.py::TestToxRun::()::test_toxuone_env
FAIL tests/test_z_cmdline.py::TestToxRun::()::test_json
FAIL tests/test_z_cmdline.py::test_test_piphelp
FAIL tests/test_z_cmdline.py::test_notest
FAIL tests/test_z_cmdline.py::test_PYC
FAIL tests/test_z_cmdline.py::test_sdistonly
FAIL tests/test_z_cmdline.py::test_separate_sdist_no_sdistfile
FAIL tests/test_z_cmdline.py::test_separate_sdist
FAIL tests/test_z_cmdline.py::test_envsitepackagesdir
[...]
================================================== FAILURES ==================================================
__________________________________________________ TestCmdInvocation.test_help __________________________________________________

self = <test_config.TestCmdInvocation instance at 0x3a27e083200>, cmd = <tox._pytestplugin.Cmd instance at 0x3a27e0832d8>

    def test_help(self, cmd):
>       result = cmd.run("tox", "-h")

../../../../../work/tox-1.8.1/tests/test_config.py:1293: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <tox._pytestplugin.Cmd instance at 0x3a27e0832d8>, argv = ['tox', '-h'], x = '-h'

    def run(self, *argv):
        argv = [str(x) for x in argv]
>       assert py.path.local.sysfind(str(argv[0])), argv[0]
E       AssertionError: tox

../../../../../work/tox-1.8.1-python2_7/lib/tox/_pytestplugin.py:183: AssertionError

[...]


and many more with the same assertion error.
The reason for the failure is that the executable "tox" (that's the value of argv[0]) cannot be found by py.path.local.sysfind since "tox" it is in the process of being installed.

Note that for this to happen no old installation of tox must be present on the system, otherwise the old executable will be found and tested (which is kind of pointless for the test-suite).

A way to reproduce the issue with a working tox installed is to create a fake tox executable some where and appending the path to the fake tox at the start of PATH, so the fake tox gets found before the real tox.

The same failure happens when running the tests directly from the extracted tar-ball with PYTHONPATH=. py.test tests .

When using the setup.py script of the tox source-tarball, then the executable gets build (and installed in a temporary location) first and afterwards the tests are run.
Comment 1 Pacho Ramos gentoo-dev 2017-01-18 12:47:50 UTC
and what about 2.4.1?
Comment 2 Maram 2017-01-29 07:51:08 UTC
Still the same failure for 2.4.1: All tests pass except the tests which call the executable 'tox' (which is then not found).
Comment 3 Maram 2017-02-18 10:12:46 UTC
Created attachment 464200 [details, diff]
Skip test which need the 'tox' executable installed
Comment 4 Maram 2017-02-18 10:13:15 UTC
Created attachment 464202 [details, diff]
Patch for the tox ebuild to apply above patch
Comment 5 Maram 2017-02-18 10:14:49 UTC
Above a patch which skips the tests which need the 'tox' executable installed.

Note: That there is some collateral damage since the patch skips all tests in tests/test_z_cmdline.py. However, there are a few (~5) which do not depend on the 'tox' executable. However, it would be to cumbersome to mark every other test to skip except those few.
Comment 6 Maram 2017-02-19 13:06:16 UTC
I played around with 'distutils_install_for_testing', sadly the tests need the executable and still cannot find it.
The simple trick with

    python_test() {
        distutils_install_for_testing
        PATH="${TEST_DIR}/scripts:${PATH}" py.test -v -v tests || die "Testsuite failed under ${EPYTHON}" 
    }

Does not work. The test suite now finds the fitting executable 'tox'. But executing this file yields the error

    pkg_resources.DistributionNotFound: The 'tox==2.4.1' distribution was not found and is required by the application

So it seems that the executable cannot find its correct python environment.

Feel free to investigate further, since I have no clue how to continue from here and how Python packages and in particular Python packages in portage/ebuilds work.
Comment 7 moxian 2017-08-03 20:16:39 UTC
Still an issue with dev-python/tox-2.4.1
Comment 8 Toralf Förster gentoo-dev 2017-08-03 21:50:47 UTC
*** Bug 623294 has been marked as a duplicate of this bug. ***
Comment 9 Virgil Dupras (RETIRED) gentoo-dev 2018-08-12 12:25:29 UTC
Since the filing of this bug, time passed and tests were RESTRICTed in dev-python/tox. In the bump I've just made to v3.2.1, I re-enabled tests and made sure that they passed on a network-sandboxed machine that didn't have tox installed. There's 8 tests I needed to exclude, although I'm not sure that the root cause it the same for all of them.
Comment 10 Maram 2018-08-18 06:15:03 UTC
Hi Virgil

Thanks for your efforts!