FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

remove pytest_exception_interact hook by timoffex · Pull Request #197 · pytest-dev/pytest-timeout · GitHub

Repository navigation

remove pytest_exception_interact hook - #197

Merged
flub merged 1 commit into
pytest-dev:mainfrom
timoffex:main
Jun 30, 2026
Merged

flub merged 1 commit into
pytest-dev:mainfrom
timoffex:main

Conversation

Copy link
Copy Markdown
Contributor

Removes the hook so that fixture teardowns can time out after a failed test. See issue #196 for details!

The pytest_enter_pdb hook handles debugger interactions, so I believe the original purpose of this hook is covered. I can't think of any other reason someone might find this behavior useful.

timoffex marked this pull request as ready for review June 29, 2026 19:07

flub left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Interesting, have you tested the --pdb behaviour?

Comment thread test_pytest_timeout.py Outdated

def test_foo(self, fix):
pass
{"assert False" if fail else "pass"}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

can assert {fail} or something close to it work? seems slightly simpler

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

good idea, updated!

Copy link
Copy Markdown
Contributor Author

Interesting, have you tested the --pdb behaviour?

Yes, tried that out as well. I used this script:

import time

import pytest


@pytest.fixture
def bad_fixture():
    yield
    time.sleep(5)


def test_timeout(bad_fixture):
    assert False

And ran it with pytest --pdb --timeout 1. It enters the debugger on assert False and cancels the timeout (it doesn't trigger if you sit in the debugger for a few seconds, and it doesn't trigger in bad_fixture afterward if you use the continue command).

timoffex requested a review from flub June 30, 2026 17:05

flub commented Jun 30, 2026

Copy link
Copy Markdown
Member

I assume this breaks compatibility with some older versions of pytest. But we already require pytest >= 7.0 which was from 2022 it seems. Which is way older than 2014 when the newer hook was added.

flub merged commit 3912a19 into pytest-dev:main Jun 30, 2026
10 checks passed

Copy link
Copy Markdown
Contributor Author

Looks like it's pytest>=8.0.0 for the upcoming release. I tested with pytest==8.0.0 as well just to make sure; everything seems fine!

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

2 participants


Back | FazBrowse Home | New Git URL