Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.8.0: pytest is failing #50

Open
kloczek opened this issue Jan 3, 2022 · 13 comments
Open

1.8.0: pytest is failing #50

kloczek opened this issue Jan 3, 2022 · 13 comments

Comments

@kloczek
Copy link

kloczek commented Jan 3, 2022

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.

  • python3 -sBm build -w
  • install .whl file in </install/prefix>
  • run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

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
Copy link
Author

kloczek commented Jan 3, 2022

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
Copy link
Owner

smarie commented Jan 10, 2022

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
Copy link
Author

kloczek commented Jan 14, 2022

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
Copy link
Owner

smarie commented Jan 19, 2022

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
Copy link
Author

kloczek commented Jan 19, 2022

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
Copy link
Owner

smarie commented Jan 20, 2022

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
Copy link
Author

kloczek commented Apr 6, 2022

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
Copy link
Author

kloczek commented Jun 16, 2022

gentle ping .. any update 😋

@smarie
Copy link
Owner

smarie commented Jun 17, 2022

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
Copy link
Author

kloczek commented Apr 27, 2023

Any update? 🤔

@kloczek
Copy link
Author

kloczek commented Apr 27, 2023

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
Copy link
Owner

smarie commented May 2, 2023

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
Copy link
Author

kloczek commented Jan 27, 2024

Any update? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants