Skip to content

Commit

Permalink
deprecate py38 support
Browse files Browse the repository at this point in the history
  • Loading branch information
bmw committed Dec 18, 2024
1 parent 035ea35 commit 5fcdb29
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Changelog
1.15.0 (master)
---------------
* Dropped support for Python 3.7.
* Support for Python 3.8 has been deprecated and will be removed in the next
scheduled release.

1.14.0 (2023-11-01)
-------------------
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ disallow_untyped_defs = true
filterwarnings = [
"error",
"ignore:CSR support in pyOpenSSL is deprecated:DeprecationWarning",
# We ignore our own warning about dropping Python 3.8 support.
"ignore:Python 3.8 support will be dropped:DeprecationWarning",
]
norecursedirs = "*.egg .eggs dist build docs .tox"

Expand Down
10 changes: 10 additions & 0 deletions src/josepy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
"""

import sys
import warnings

# flake8: noqa
from josepy.b64 import b64decode, b64encode
from josepy.errors import (
Expand Down Expand Up @@ -73,3 +76,10 @@
ComparableX509,
ImmutableMap,
)

if sys.version_info[:2] == (3, 8):
warnings.warn(
"Python 3.8 support will be dropped in the next scheduled release of "
"josepy. Please upgrade your Python version.",
DeprecationWarning,
)
25 changes: 25 additions & 0 deletions tests/init_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import importlib
import re
import sys
import warnings

import pytest

import josepy


@pytest.mark.skipif(sys.version_info[:2] != (3, 8), reason="requires Python 3.8")
def test_warns() -> None:
with pytest.warns(DeprecationWarning, match=re.escape(r"Python 3.8 support")):
importlib.reload(josepy)


@pytest.mark.skipif(sys.version_info[:2] == (3, 8), reason="requires Python != 3.8")
def test_does_not_warn() -> None:
with warnings.catch_warnings():
warnings.simplefilter("error")
importlib.reload(josepy)


if __name__ == "__main__":
sys.exit(pytest.main(sys.argv[1:] + [__file__])) # pragma: no cover

0 comments on commit 5fcdb29

Please sign in to comment.