smarie / python-pytest-steps

A tiny package to ease the creation of test steps with shared intermediate results/state.
https://smarie.github.io/python-pytest-steps/
BSD 3-Clause "New" or "Revised" License
57 stars 5 forks source link

1.8.0: pytest is failing #50

Open kloczek opened 2 years ago

kloczek commented 2 years ago

I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

First just run pytest:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-steps-1.8.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-steps-1.8.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/tkloczko/rpmbuild/BUILD/python-pytest-steps-1.8.0, configfile: setup.cfg, testpaths: pytest_steps/tests/
plugins: steps-1.8.0
collected 0 items / 1 error

================================================================================== ERRORS ==================================================================================
______________________________________________________________________ ERROR collecting test session _______________________________________________________________________
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:961: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:973: in _find_and_load_unlocked
    ???
E   ModuleNotFoundError: No module named 'pytest_steps.tests'
========================================================================= short test summary info ==========================================================================
ERROR  - ModuleNotFoundError: No module named 'pytest_steps.tests'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================= 1 error in 0.22s =============================================================================

Because pytest_steps.tests is not installed I've been trying to preload it using --pyargs:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-steps-1.8.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-steps-1.8.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra --pyargs pytest_steps.tests
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/tkloczko/rpmbuild/BUILD/python-pytest-steps-1.8.0, configfile: setup.cfg
plugins: steps-1.8.0
collected 0 items

========================================================================== no tests ran in 0.02s ===========================================================================
ERROR: module or package not found: pytest_steps.tests (missing __init__.py?)
kloczek commented 2 years ago

nox is failing as well:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-steps-1.8.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ nox
nox > Running session tests-3.9(env='pytest-latest')
nox > Creating conda env in .nox/tests-3-9-env-pytest-latest with python=3.9
nox > Program conda not found.
nox > Session tests-3.9(env='pytest-latest') failed.
nox > Running session tests-3.9(env='pytest4.x')
nox > Creating conda env in .nox/tests-3-9-env-pytest4-x with python=3.9
nox > Program conda not found.
nox > Session tests-3.9(env='pytest4.x') failed.
nox > Running session tests-3.9(env='pytest5.x')
nox > Creating conda env in .nox/tests-3-9-env-pytest5-x with python=3.9
nox > Program conda not found.
nox > Session tests-3.9(env='pytest5.x') failed.
nox > Running session tests-3.9(env='pytest2.x')
nox > Creating conda env in .nox/tests-3-9-env-pytest2-x with python=3.9
nox > Program conda not found.
nox > Session tests-3.9(env='pytest2.x') failed.
nox > Running session tests-3.9(env='pytest3.x')
nox > Creating conda env in .nox/tests-3-9-env-pytest3-x with python=3.9
nox > Program conda not found.
nox > Session tests-3.9(env='pytest3.x') failed.
nox > Running session tests-3.8(env='pytest-latest')
nox > Creating conda env in .nox/tests-3-8-env-pytest-latest with python=3.8
nox > Program conda not found.
nox > Session tests-3.8(env='pytest-latest') failed.
nox > Running session tests-3.8(env='pytest4.x')
nox > Creating conda env in .nox/tests-3-8-env-pytest4-x with python=3.8
nox > Program conda not found.
nox > Session tests-3.8(env='pytest4.x') failed.
nox > Running session tests-3.8(env='pytest5.x')
nox > Creating conda env in .nox/tests-3-8-env-pytest5-x with python=3.8
nox > Program conda not found.
nox > Session tests-3.8(env='pytest5.x') failed.
nox > Running session tests-3.8(env='pytest2.x')
nox > Creating conda env in .nox/tests-3-8-env-pytest2-x with python=3.8
nox > Program conda not found.
nox > Session tests-3.8(env='pytest2.x') failed.
nox > Running session tests-3.8(env='pytest3.x')
nox > Creating conda env in .nox/tests-3-8-env-pytest3-x with python=3.8
nox > Program conda not found.
nox > Session tests-3.8(env='pytest3.x') failed.
nox > Running session tests-2.7(env='pytest-latest')
nox > Re-using existing conda env at .nox/tests-2-7-env-pytest-latest.
nox > Skipping configuration, this is not supported in python version '2.7'
nox > Session tests-2.7(env='pytest-latest') was successful.
nox > Running session tests-2.7(env='pytest4.x')
nox > Creating conda env in .nox/tests-2-7-env-pytest4-x with python=2.7
nox > Program conda not found.
nox > Session tests-2.7(env='pytest4.x') failed.
nox > Running session tests-2.7(env='pytest5.x')
nox > Creating conda env in .nox/tests-2-7-env-pytest5-x with python=2.7
nox > Program conda not found.
nox > Session tests-2.7(env='pytest5.x') failed.
nox > Running session tests-2.7(env='pytest2.x')
nox > Creating conda env in .nox/tests-2-7-env-pytest2-x with python=2.7
nox > Program conda not found.
nox > Session tests-2.7(env='pytest2.x') failed.
nox > Running session tests-2.7(env='pytest3.x')
nox > Creating conda env in .nox/tests-2-7-env-pytest3-x with python=2.7
nox > Program conda not found.
nox > Session tests-2.7(env='pytest3.x') failed.
nox > Running session tests-3.5(env='pytest-latest')
nox > Creating conda env in .nox/tests-3-5-env-pytest-latest with python=3.5
nox > Program conda not found.
nox > Session tests-3.5(env='pytest-latest') failed.
nox > Running session tests-3.5(env='pytest4.x')
nox > Creating conda env in .nox/tests-3-5-env-pytest4-x with python=3.5
nox > Program conda not found.
nox > Session tests-3.5(env='pytest4.x') failed.
nox > Running session tests-3.5(env='pytest5.x')
nox > Creating conda env in .nox/tests-3-5-env-pytest5-x with python=3.5
nox > Program conda not found.
nox > Session tests-3.5(env='pytest5.x') failed.
nox > Running session tests-3.5(env='pytest2.x')
nox > Creating conda env in .nox/tests-3-5-env-pytest2-x with python=3.5
nox > Program conda not found.
nox > Session tests-3.5(env='pytest2.x') failed.
nox > Running session tests-3.5(env='pytest3.x')
nox > Creating conda env in .nox/tests-3-5-env-pytest3-x with python=3.5
nox > Program conda not found.
nox > Session tests-3.5(env='pytest3.x') failed.
nox > Running session tests-3.6(env='pytest-latest')
nox > Creating conda env in .nox/tests-3-6-env-pytest-latest with python=3.6
nox > Program conda not found.
nox > Session tests-3.6(env='pytest-latest') failed.
nox > Running session tests-3.6(env='pytest4.x')
nox > Creating conda env in .nox/tests-3-6-env-pytest4-x with python=3.6
nox > Program conda not found.
nox > Session tests-3.6(env='pytest4.x') failed.
nox > Running session tests-3.6(env='pytest5.x')
nox > Creating conda env in .nox/tests-3-6-env-pytest5-x with python=3.6
nox > Program conda not found.
nox > Session tests-3.6(env='pytest5.x') failed.
nox > Running session tests-3.6(env='pytest2.x')
nox > Creating conda env in .nox/tests-3-6-env-pytest2-x with python=3.6
nox > Program conda not found.
nox > Session tests-3.6(env='pytest2.x') failed.
nox > Running session tests-3.6(env='pytest3.x')
nox > Creating conda env in .nox/tests-3-6-env-pytest3-x with python=3.6
nox > Program conda not found.
nox > Session tests-3.6(env='pytest3.x') failed.
nox > Running session tests-3.7(env='pytest-latest')
nox > Creating conda env in .nox/tests-3-7-env-pytest-latest with python=3.7
nox > Program conda not found.
nox > Session tests-3.7(env='pytest-latest') failed.
nox > Running session tests-3.7(env='pytest4.x')
nox > Creating conda env in .nox/tests-3-7-env-pytest4-x with python=3.7
nox > Program conda not found.
nox > Session tests-3.7(env='pytest4.x') failed.
nox > Running session tests-3.7(env='pytest5.x')
nox > Creating conda env in .nox/tests-3-7-env-pytest5-x with python=3.7
nox > Program conda not found.
nox > Session tests-3.7(env='pytest5.x') failed.
nox > Running session tests-3.7(env='pytest2.x')
nox > Creating conda env in .nox/tests-3-7-env-pytest2-x with python=3.7
nox > Program conda not found.
nox > Session tests-3.7(env='pytest2.x') failed.
nox > Running session tests-3.7(env='pytest3.x')
nox > Creating conda env in .nox/tests-3-7-env-pytest3-x with python=3.7
nox > Program conda not found.
nox > Session tests-3.7(env='pytest3.x') failed.
nox > Running session flake8
nox > Creating conda env in .nox/flake8 with python=3.8
nox > Program conda not found.
nox > Session flake8 failed.
nox > Ran multiple sessions:
nox > * tests-3.9(env='pytest-latest'): failed
nox > * tests-3.9(env='pytest4.x'): failed
nox > * tests-3.9(env='pytest5.x'): failed
nox > * tests-3.9(env='pytest2.x'): failed
nox > * tests-3.9(env='pytest3.x'): failed
nox > * tests-3.8(env='pytest-latest'): failed
nox > * tests-3.8(env='pytest4.x'): failed
nox > * tests-3.8(env='pytest5.x'): failed
nox > * tests-3.8(env='pytest2.x'): failed
nox > * tests-3.8(env='pytest3.x'): failed
nox > * tests-2.7(env='pytest-latest'): success
nox > * tests-2.7(env='pytest4.x'): failed
nox > * tests-2.7(env='pytest5.x'): failed
nox > * tests-2.7(env='pytest2.x'): failed
nox > * tests-2.7(env='pytest3.x'): failed
nox > * tests-3.5(env='pytest-latest'): failed
nox > * tests-3.5(env='pytest4.x'): failed
nox > * tests-3.5(env='pytest5.x'): failed
nox > * tests-3.5(env='pytest2.x'): failed
nox > * tests-3.5(env='pytest3.x'): failed
nox > * tests-3.6(env='pytest-latest'): failed
nox > * tests-3.6(env='pytest4.x'): failed
nox > * tests-3.6(env='pytest5.x'): failed
nox > * tests-3.6(env='pytest2.x'): failed
nox > * tests-3.6(env='pytest3.x'): failed
nox > * tests-3.7(env='pytest-latest'): failed
nox > * tests-3.7(env='pytest4.x'): failed
nox > * tests-3.7(env='pytest5.x'): failed
nox > * tests-3.7(env='pytest2.x'): failed
nox > * tests-3.7(env='pytest3.x'): failed
nox > * flake8: failed
smarie commented 2 years ago

Your last message is simply due to conda not being installed. However for the first message, this is a structure problem as in pytest-cases, I'll have to adopt the src/tests separation as in pytest-cases. I'll let you know

kloczek commented 2 years ago

If may I ask .. for what is used conda in those tests? πŸ€” I still have no packaged conda so I'm trying to asses impact of skipping those test.

Thx.

smarie commented 2 years ago

conda is used to ensure reproducible multi-python-version builds in all my python repositories. Historically (a few years back) it was the only system able to get reliable builds across platforms (windows, etc.), especially when compiled wheels where needed.

I still use it for this reason and the convenience, although more and more packages (e.g. pandas) now publish pre-compiled wheels for major platforms so conda is less and less mandatory.

kloczek commented 2 years ago

conda is used to ensure reproducible multi-python-version builds in all my python repositories.

During build rpm packag I need to be sure that test suite execution result will deliver result against exat version of the python usied during build process. I know that maybe I'm asking for to much but maybe it would be good to move such tests one layer above plan test suite execution because in such scenarios like mine the test suite would be always kind of useless/producing false results? πŸ€”

smarie commented 2 years ago

it would be to move such tests one layer above plan test suite execution

what do you mean ?

I plan to do with this repo the same as in pytest-cases (you know, the clean separation between src and tests) so that running pytest should work for you.

kloczek commented 2 years ago

I plan to do with this repo the same as in pytest-cases (you know, the clean separation between src and tests) so that running pytest should work for you.

That will solve pytest

______________________________________________________________________ ERROR collecting test session _______________________________________________________________________
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:961: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:973: in _find_and_load_unlocked
    ???
E   ModuleNotFoundError: No module named 'pytest_steps.tests'
========================================================================= short test summary info ==========================================================================

In this case pytest i scanning source tree but is loading modul;es from $PYTHONPATH. Because pytest_steps.tests is not isntalled pytest cannot find it.

kloczek commented 2 years ago

gentle ping .. any update πŸ˜‹

smarie commented 2 years ago

Probably during summer I will do this one and pytest-harvest. A bit hard to find time :( If you have the possibility to propose a PR following the one I did in pytest-cases (https://github.com/smarie/python-pytest-cases/pull/232/files) do not hesitate to go for it!

kloczek commented 1 year ago

Any update? πŸ€”

kloczek commented 1 year ago

One more thing: you need to remove use pytest-runner becauae it is already deprecated. Look on "Deprecation Notice" on https://github.com/pytest-dev/pytest-runner/ This module will be archived soon.

smarie commented 1 year ago

Thanks @kloczek ! Still no time to work on this on my side currently I'm afraid. Since it does not prevent users to use it it goes into lower priority than other issues on other libs :( But I still hope to get it done

kloczek commented 9 months ago

Any update? πŸ€”