Skip to content

pytest>6.2.0 emits warnings for unraisable exceptions and unhandled thread exceptions under Python 3.8+Β #355

@webknjaz

Description

@webknjaz

❓ I'm submitting a ...

  • 🐞 tests bug report
  • 🐞 bug report
  • 🐣 feature request
  • ❓ question about the decisions made in the repository

🐞 Describe the bug. What is the current behavior?

pytest 6.2.0 introduced unraisableexception and threadexception modules that are enabled by default. They exploit sys.unraisablehook and threading.excepthook that were introduced in Python 3.8.
This makes pytest emit warnings for unclosed resources and unhandled exceptions that happen in threads when run under Python 3.8.

Our pytest.ini turns those exceptions into errors with filterwarnings = error which results in a failed test run outcome under the conditions described above.

The short-term solution is to patch the filterwarnings setting but in the long-term we need to investigate how to prevent those permanently.

❓ What is the motivation / use case for changing the behavior?

Green tests.

πŸ’‘ To Reproduce

Run tox under Python 3.8+ on master.

πŸ’‘ Expected behavior

No errors in CI.

πŸ“‹ Details

https://docs.pytest.org/en/stable/usage.html#unraisable

πŸ“‹ Environment

  • Cheroot version: master
  • CherryPy version: N/A
  • Python version: 3.8+
  • OS: N/A
  • Browser: N/A

πŸ“‹ Additional context

pytest-dev/pytest#5299

Metadata

Metadata

Assignees

Labels

bugSomething is broken

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions