Skip to content

Commit

Permalink
Merge pull request #384 from TheHive-Project/361-add-deprecation-warn…
Browse files Browse the repository at this point in the history
…ing-for-python-38

#361 - Add deprecation warning for python 3.8
  • Loading branch information
Kamforka authored Jan 14, 2025
2 parents 00a4ceb + c8e326a commit 82ad1ab
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_init.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import sys

import pytest

from thehive4py import _warn_old_py_version


def test_warn_old_py_version():
actual_py_version = sys.version_info
dummy_min_py_version = (actual_py_version[0], actual_py_version[1] + 1)
with pytest.deprecated_call():
_warn_old_py_version(min_py_version=dummy_min_py_version)
19 changes: 19 additions & 0 deletions thehive4py/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
from thehive4py.client import TheHiveApi


def _warn_old_py_version(min_py_version=(3, 9)):
import sys
import warnings

if sys.version_info < min_py_version:
warnings.warn(
message=(
"thehive4py will drop support for Python versions below "
f"{min_py_version[0]}.{min_py_version[1]}, as they have reached their "
"end of life. Please upgrade to a newer version as soon as possible."
),
category=DeprecationWarning,
stacklevel=3,
)


_warn_old_py_version()

0 comments on commit 82ad1ab

Please sign in to comment.