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

3.0.1: pytest is failing #2006

Closed
kloczek opened this issue Jan 20, 2022 · 16 comments
Closed

3.0.1: pytest is failing #2006

kloczek opened this issue Jan 20, 2022 · 16 comments

Comments

@kloczek
Copy link

kloczek commented Jan 20, 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 --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix>
  • run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

Lookks like something is wrong in use of aioredis
Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-falcon-3.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-falcon-3.0.1-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
rootdir: /home/tkloczko/rpmbuild/BUILD/falcon-3.0.1, configfile: setup.cfg
plugins: cov-3.0.0, flake8-1.0.7, anyio-3.3.4, asyncio-0.17.2
asyncio: mode=legacy
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>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:170: in exec_module
    exec(co, module.__dict__)
examples/asgilook/tests/conftest.py:12: in <module>
    from asgilook.app import create_app
examples/asgilook/asgilook/app.py:4: in <module>
    from .config import Config
examples/asgilook/asgilook/config.py:8: in <module>
    class Config:
examples/asgilook/asgilook/config.py:12: in Config
    DEFAULT_REDIS_POOL = aioredis.create_redis_pool
E   AttributeError: module 'aioredis' has no attribute 'create_redis_pool'
============================================================================= warnings summary =============================================================================
../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:191
  /usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:191: DeprecationWarning: The 'asyncio_mode' default value will change to 'strict' in future, please explicitly use 'asyncio_mode=strict' or 'asyncio_mode=auto' in pytest configuration file.
    config.issue_config_time_warning(LEGACY_MODE, stacklevel=2)

-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================= short test summary info ==========================================================================
ERROR  - AttributeError: module 'aioredis' has no attribute 'create_redis_pool'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================================================= 1 warning, 1 error in 0.72s ========================================================================
@kloczek
Copy link
Author

kloczek commented Jan 20, 2022

Forgot to add that I'm using aioredis 2.0.1.

@vytas7
Copy link
Member

vytas7 commented Jan 20, 2022

Hi @kloczek!
It is up to you, but it is IMHO quite unusual for packaging tests to include asgilook, E2E or similar. From what I've seen in Falcon's packaging for Debian, Fedora/RedHat, Gentoo, etc, people just exercise the main test suite (i.e. the tests/ directory).

That being said, it is not possible to resolve your issue for 3.0.1 without releasing a new minor or micro version, because aioredis was released after 3.0.1, so we had no clue they would change the interface so radically. The issue (#1938) is resolved in our master branch via #1987. As such, we simply can not do anything meaningful here; closing this as duplicate.

(We are hoping to get 3.1.0 out the door some time in February.)

@vytas7 vytas7 closed this as completed Jan 20, 2022
@vytas7
Copy link
Member

vytas7 commented Jan 20, 2022

Duplicates #1938

@vytas7 vytas7 reopened this Jan 20, 2022
@vytas7 vytas7 closed this as completed Jan 20, 2022
@vytas7 vytas7 changed the title 3.0.1: pytest is filing 3.0.1: pytest is failing Jan 20, 2022
@vytas7 vytas7 added this to the Version 3.1 milestone Jan 20, 2022
@kloczek
Copy link
Author

kloczek commented Jun 27, 2022

Just back to falcon trying to finish package 3.1.0.
Looks like I need asgilook and there is no that module on pypi.

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-falcon-3.1.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-falcon-3.1.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra --import-mode=importlib
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/falcon-3.1.0, configfile: setup.cfg
collected 0 items / 1 error

================================================================================== ERRORS ==================================================================================
______________________________________________________________________ ERROR collecting test session _______________________________________________________________________
examples/asgilook/tests/conftest.py:12: in <module>
    from asgilook.app import create_app
E   ModuleNotFoundError: No module named 'asgilook'
========================================================================= short test summary info ==========================================================================
ERROR  - ModuleNotFoundError: No module named 'asgilook'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================= 1 error in 0.50s =============================================================================

Any hints?

@kloczek
Copy link
Author

kloczek commented Jun 27, 2022

It is up to you, but it is IMHO quite unusual for packaging tests to include asgilook, E2E or similar. From what I've seen in Falcon's packaging for Debian, Fedora/RedHat, Gentoo, etc, people just exercise the main test suite (i.e. the tests/ directory).

If only tests/ should be used this patch should be added as testpaths in pytest.ini or pyporoject.toml.

@vytas7
Copy link
Member

vytas7 commented Jun 27, 2022

This issue has been resolved in Falcon 3.1.0 regardless of what should be included in the test suite.
We are not bugfixing SemVer minor versions, please upgrade to 3.1.0.

@kloczek
Copy link
Author

kloczek commented Jun 27, 2022

This issue has been resolved in Falcon 3.1.0 regardless of what should be included in the test suite.

3.1.0 still has missing testpaths setings.

@vytas7
Copy link
Member

vytas7 commented Jun 27, 2022

Thanks, but it sounds like an orthogonal suggestion. asgilook tests are now expected to succeed should you decide to include them.

@kloczek
Copy link
Author

kloczek commented Jun 27, 2022

I wpould like to not stamp on sometbing wgich is still not working like I've reported that in #2006 (comment) (which is about last 3.1.0).
Just please make a decision about ise more than tests/ at the time when it will be ready.

@vytas7
Copy link
Member

vytas7 commented Jun 27, 2022

I'll file testpaths as a separate suggestion, thanks.
Re the current test (in fact, these are supplement material to one of our tutorials) at hand, I beg to differ on whether this is an issue. We do not necessarily support all our tests being able to run in isolation, we use tox.

Please invoke as tox -e asgilook.

@kloczek
Copy link
Author

kloczek commented Jun 27, 2022

Please invoke as tox -e asgilook.

"Nobody expects the Spanish Inquisition" ..
If that part of examples why not just use examples.asgilook in import lines? 🤔

@vytas7
Copy link
Member

vytas7 commented Jun 27, 2022

Because the tutorial is written from the reader's perspective building a new project using Falcon, outside of Falcon's source tree.

I'm still not convinced why pytest should work without parameters. Is that defined somewhere in our setup configuration that this is the way how to test the Falcon package?

Why use tox for testing, not pytest. If you invoke pytest in a different way, you're on your own.

@CaselIT
Copy link
Member

CaselIT commented Jun 27, 2022

I think adding testpaths to the pytest setup.cfg file will solve most problems wrt pytest invocation without parameters

@vytas7
Copy link
Member

vytas7 commented Jun 27, 2022

Yes, I'll file that as a separate suggestion.

@CaselIT it is unclear whether that would help, because I saw in another issue by the same reporter that setup.cfg was not used at all.

@CaselIT
Copy link
Member

CaselIT commented Jun 27, 2022

Unless that's removed by hand that seems very strange that pytest is not picking it up. Regardless adding that should not make things any worse

@vytas7
Copy link
Member

vytas7 commented Jun 27, 2022

Filed as #2082

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

No branches or pull requests

3 participants