[Python] Why does my Python test run fail when invoked via Tox, despite running just fine when...

Discussão em 'Python' iniciado por Stack, Abril 6, 2025.

  1. Stack

    Stack Membro Participativo

    When I invoke my Python package testing in the usual way, via Tox, it's failing:

    $ python -I -m tox run -e py310-lin
    py310-lin: install_deps> python -I -m pip install pytest pytest-cov pytest-xdist typing_extensions PyAMI/dist/pyibis_ami-7.2.2-py3-none-any.whl
    .pkg: install_requires> python -I -m pip install 'setuptools>=77.0'
    .pkg: _optional_hooks> python /home/dbanas/.venv/pybert-dev/lib/python3.10/site-packages/pyproject_api/_backend.py True setuptools.build_meta
    .pkg: get_requires_for_build_wheel> python /home/dbanas/.venv/pybert-dev/lib/python3.10/site-packages/pyproject_api/_backend.py True setuptools.build_meta
    .pkg: build_wheel> python /home/dbanas/.venv/pybert-dev/lib/python3.10/site-packages/pyproject_api/_backend.py True setuptools.build_meta
    py310-lin: install_package_deps> python -I -m pip install kiwisolver 'pyibis-ami>=7.2.2' 'pyside6<6.7' 'pyyaml>=6' 'scikit-rf>=0.29' typing_extensions
    py310-lin: install_package> python -I -m pip install --force-reinstall --no-deps /home/dbanas/prj/PyBERT/.tox/.tmp/package/1/pipbert-7.2.2-py3-none-any.whl
    py310-lin: commands[0]> python -m pytest --basetemp=/home/dbanas/prj/PyBERT/.tox/py310-lin/tmp -vv --cov=pybert --cov-report=html --cov-report=term-missing tests
    py310-lin: exit -6 (8.83 seconds) /home/dbanas/prj/PyBERT> python -m pytest --basetemp=/home/dbanas/prj/PyBERT/.tox/py310-lin/tmp -vv --cov=pybert --cov-report=html --cov-report=term-missing tests pid=1351
    py310-lin: FAIL code -6 (38.56=setup[29.73]+cmd[8.83] seconds)
    evaluation failed :( (38.62 seconds)


    However, I'm able to run it manually, using the same Tox test environment, just fine:

    $ . .tox/py310-lin/bin/activate
    (py310-lin)
    dbanas@Dell-XPS-15:~/prj/PyBERT
    $ python -m pytest --basetemp=/home/dbanas/prj/PyBERT/.tox/py310-lin/tmp -vv --cov=pybert --cov-report=html --cov-report=term-missing tests
    =============================================================================== test session starts ================================================================================
    platform linux -- Python 3.10.12, pytest-8.3.5, pluggy-1.5.0 -- /home/dbanas/prj/PyBERT/.tox/py310-lin/bin/python
    cachedir: .pytest_cache
    rootdir: /home/dbanas/prj/PyBERT
    configfile: pyproject.toml
    plugins: xdist-3.6.1, cov-6.1.1
    collected 63 items

    tests/test_basic.py::TestBasic::test_status PASSED [ 1%]
    tests/test_basic.py::TestBasic::test_perf PASSED [ 3%]
    tests/test_basic.py::TestBasic::test_ber PASSED [ 4%]
    tests/test_basic.py::TestBasic::test_dly PASSED [ 6%]
    tests/test_basic.py::TestBasic::test_isi PASSED [ 7%]
    tests/test_basic.py::TestBasic::test_dcd PASSED [ 9%]
    tests/test_basic.py::TestBasic::test_pj PASSED [ 11%]
    {Many more passed tests omitted.}
    =================================================================== 63 passed, 28 warnings in 102.85s (0:01:42) ====================================================================


    So, why is this failing under Tox control?

    Continue reading...

Compartilhe esta Página