-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #384 from TheHive-Project/361-add-deprecation-warn…
…ing-for-python-38 #361 - Add deprecation warning for python 3.8
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |