Skip to content

Conversation

@fry69
Copy link

@fry69 fry69 commented Oct 10, 2025

fix #669

This tiny patch fixes the Python 3.14 datetime deprecation warning while maintaining expected output format (without timezone information).

It should be compatible with Python 3.10 and up, but I have not tested this explicitly.

Update: The 2nd commit adds a suppression for another Python 3.14 related warning.

Pytest now runs completely without warnings on Python 3.14:

$ pytest
=== test session starts ===
platform darwin -- Python 3.14.0, pytest-8.4.2, pluggy-1.6.0
[...]
=== 1001 passed, 16 skipped in 5.94s ===

Generated explanation below:


Added a pytest marker to the test_dateparse_errors function:

@pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning")
def test_dateparse_errors(fresh_db, fn, errors):
    # ... test code ...

This decorator tells pytest to ignore PytestUnraisableExceptionWarning warnings for this specific test. This is the correct approach because:

  1. The warnings are informational, not errors - The exceptions ARE being properly handled (they result in OperationalError as expected)
  2. This is expected behavior - When SQLite user-defined functions raise exceptions, SQLite converts them to OperationalError, which the test correctly catches
  3. Python 3.14 is just more strict - The new warning system flags these as "unraisable" even though they're handled correctly
  4. Test-specific solution - Only the tests that intentionally trigger exceptions need this filter

📚 Documentation preview 📚: https://sqlite-utils--671.org.readthedocs.build/en/671/

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.

Some DeprecationWarning in test suite with Python 3.14

1 participant