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

Failures during test collection aren't shown #75

Open
edmorley opened this issue Nov 8, 2022 · 1 comment
Open

Failures during test collection aren't shown #75

edmorley opened this issue Nov 8, 2022 · 1 comment
Labels
bug Something isn't working pytest parity Bring pytest-rich up to feature parity with pytest’s built-in terminal reporter

Comments

@edmorley
Copy link

edmorley commented Nov 8, 2022

If I make a Python syntax error in a test, or one of the project files imported by one of the tests, with stock pytest, I get an error like:

$ pytest
====================================== test session starts =======================================
platform darwin -- Python 3.11.0, pytest-7.2.0, pluggy-1.0.0
rootdir: /Users/<snip>, configfile: pyproject.toml, testpaths: tests
plugins: anyio-3.6.2
collected 0 items / 2 errors                                                                     

============================================= ERRORS =============================================
_______________________________ ERROR collecting tests/test_cli.py _______________________________
ImportError while importing test module '<snip>/tests/test_cli.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
<snip>
=====================================
ERROR tests/test_cli.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================= 2 errors in 0.14s ========================================

However with pytest-rich installed and using pytest run using --rich, these errors are hidden:

$ pytest --rich
────────────────────────────────────────────── pytest session starts ──────────────────────────────────────────────
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ platform darwin pytest 7.2.0 python 3.11.0                                                                      │
│ root /Users/<snip>                                                                                              │
│ plugins rich-0.1.2.dev26+gaea02fb, anyio-3.6.2                                                                  │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Collected 0 items


╭──── Summary ─────╮
│  0  Total        │
│     Tests        │
╰──────────────────╯
───────────────────────────────────────────── FAILED in 0.00 seconds ──────────────────────────────────────────────

This was using the latest development version of pytest-rich (currently aea02fb).

@joshuadavidthomas joshuadavidthomas added the bug Something isn't working label Nov 8, 2022
@joshuadavidthomas
Copy link
Collaborator

Thanks for taking the time to submit this detailed issue @edmorley!

@joshuadavidthomas joshuadavidthomas added the pytest parity Bring pytest-rich up to feature parity with pytest’s built-in terminal reporter label Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pytest parity Bring pytest-rich up to feature parity with pytest’s built-in terminal reporter
Projects
None yet
Development

No branches or pull requests

2 participants