Skip to content

Commit

Permalink
chore(python): Issue a warning when running doctests on Python 3.11 o…
Browse files Browse the repository at this point in the history
…r lower (#14187)
  • Loading branch information
stinodego authored Feb 1, 2024
1 parent f47d3d6 commit a4ee27f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions py-polars/tests/docs/run_doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@
from types import ModuleType


if sys.version_info < (3, 12):
# Tests that print an OrderedDict fail (e.g. DataFrame.schema) as the repr
# has changed in Python 3.12
warnings.warn(
"Certain doctests may fail when running on a Python version below 3.12."
" Update your Python version to 3.12 or later to make sure all tests pass.",
stacklevel=2,
)


def doctest_teardown(d: doctest.DocTest) -> None:
# don't let config changes or string cache state leak between tests
polars.Config.restore_defaults()
Expand Down

0 comments on commit a4ee27f

Please sign in to comment.