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

Improve output with invalid asyncio_mode #557

Merged
merged 1 commit into from
Jun 7, 2023

Conversation

The-Compiler
Copy link
Member

Instead of a long INTERNALERROR> stack trace, output a proper error
message:

$ pytest -o asyncio_mode=True
=================== test session starts ====================
platform linux -- Python 3.11.3, pytest-7.3.1, pluggy-1.0.0
ERROR: 'True' is not a valid asyncio_mode

See pytest-dev/pytest#11083

@The-Compiler
Copy link
Member Author

The-Compiler commented Jun 6, 2023

The Python 3.12 failure is unrelated:

ImportError while loading conftest '/home/runner/work/pytest-asyncio/pytest-asyncio/tests/conftest.py'.
  /usr/lib/python3.12/ast.py:407: in visit
      return visitor(node)
  /usr/lib/python3.12/ast.py:407: in visit
      return visitor(node)
  /usr/lib/python3.12/ast.py:407: in visit
      return visitor(node)
  /usr/lib/python3.12/ast.py:584: in _new
      warnings._deprecated(
  /usr/lib/python3.12/warnings.py:5[29](https://github.com/pytest-dev/pytest-asyncio/actions/runs/5187238300/jobs/9349366651?pr=557#step:6:30): in _deprecated
      warn(msg, DeprecationWarning, stacklevel=3)
  E   DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead

Copy link
Contributor

@seifertm seifertm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! This definitely makes sense.

Could you also add an entry to docs/source/reference/changelog.rst? The new version can just be 0.22.0 (UNRELEASED)

pytest_asyncio/plugin.py Outdated Show resolved Hide resolved
@seifertm
Copy link
Contributor

seifertm commented Jun 6, 2023

I adjusted the warnings filters so that the DeprecationWarnings on Python 3.12 are ignored. The CI should be green as soon as you rebase your branch.

@The-Compiler
Copy link
Member Author

Improved and rebased!

Instead of a long INTERNALERROR> stack trace, output a proper error
message:

    $ pytest -o asyncio_mode=True
    =================== test session starts ====================
    platform linux -- Python 3.11.3, pytest-7.3.1, pluggy-1.0.0
    ERROR: 'True' is not a valid asyncio_mode. Valid modes: auto, strict.

See pytest-dev/pytest#11083
@seifertm
Copy link
Contributor

seifertm commented Jun 7, 2023

Great, thank you for the quick turnaround!

@seifertm seifertm merged commit e41af6c into pytest-dev:master Jun 7, 2023
9 checks passed
@The-Compiler The-Compiler deleted the invalid-mode-error branch June 7, 2023 09:55
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

Successfully merging this pull request may close these issues.

None yet

2 participants