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

Global SDK state (mainly: strict mode) is not correctly handled in our Python test suite #8023

Open
abey79 opened this issue Nov 6, 2024 · 0 comments
Labels
🪳 bug Something isn't working 🐍 Python API Python logging API 🔨 testing testing and benchmarks

Comments

@abey79
Copy link
Member

abey79 commented Nov 6, 2024

Our Python test suite handles extremely bad the global state of the SDK, which leaks from tests to tests.

Symptom

For example, the suite currently passes if run in its entirety:

$  pixi run -e py pytest -c rerun_py/pyproject.toml rerun_py/tests
(passes)

If you run only the quaternion suite, it fails:

$ pixi run -e py pytest -c rerun_py/pyproject.toml rerun_py/tests/unit/test_quaternion.py
(fails test_quaternion_array_invalid)

Why? Because that test expect strict mode but doesn't set it. It just happens to be set by the previous test(s) in the suite.

Proof:

$ RERUN_STRICT=1 pixi run -e py pytest -c rerun_py/pyproject.toml rerun_py/tests/unit/test_quaternion.py
(passes)

Solution

In theory, tests should each receive a rr fixture that corresponds to an isolated instance of the rerun-sdk module. Somehow. In practice, maybe some Python module shenanigans might achieve that (needs to be researched and experimented with).

@abey79 abey79 added 🪳 bug Something isn't working 🔨 testing testing and benchmarks 🐍 Python API Python logging API labels Nov 6, 2024
@abey79 abey79 changed the title Global SDK state (mainly: strict mode) is not correctly handled in our Python test suite ( Global SDK state (mainly: strict mode) is not correctly handled in our Python test suite Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪳 bug Something isn't working 🐍 Python API Python logging API 🔨 testing testing and benchmarks
Projects
None yet
Development

No branches or pull requests

1 participant