Skip to content

Fix caller control of deprecation warnings - #614

Open
bensynapse wants to merge 1 commit into
PySport:masterfrom
bensynapse:fix-deprecation-warning-filters
Open

bensynapse wants to merge 1 commit into
PySport:masterfrom
bensynapse:fix-deprecation-warning-filters

Conversation

@bensynapse

Copy link
Copy Markdown

Disclosure: I run Live Tennis API.

Fixes #383.

The deprecated decorator forces warnings to appear even when callers select ignore or error, then leaves a different warning filter installed. Remove the four filter overrides so both decorator forms honor the caller's policy. Warning messages, category, caller location and wrapped-function metadata are preserved.

Added ten tests covering ignore, default, always and error, filter preservation, argument forwarding and warning details. Eight fail on the original implementation; all ten pass with this change.

Validation on Linux with Python 3.12.13:

  • uv run python -m pytest kloppy/tests: 429 passed, one existing expected failure.
  • uv run pre-commit run -a --show-diff-on-failure: passed.
  • uv sync --locked and uv build: passed; source distribution and wheel built.

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.

Can't suppress deprecation warnings

1 participant