Skip to content

Conversation

@pem70
Copy link

@pem70 pem70 commented Dec 12, 2025

Description

Fixes #168.

This fix modifies the engine fixture in tests/api_test.py to use the pytest yield pattern. By moving the cleanup logic (api.off() and api.disable()) into the fixture's teardown phase, we guarantee that the global state is reset after every test, even if a test fails or crashes. This eliminates the "polluter" behavior where a single assertion failure causes cascading failures in subsequent tests.

It fixes the following tests: test_activate(), test_on(), test_use(), and test_mock_contructors().

PR Checklist

  • I've added tests for any code changes
  • I've documented any new features

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.

Flaky tests in api_test.py due to shared global state

1 participant