Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix deprecation warning for __version__ #543

Merged
merged 3 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion tests/test_config.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
import json
import sys
from datetime import date
from datetime import timedelta

import pytest
from dateutil.relativedelta import relativedelta
from flask import __version__ as flask_version
from flask import Flask

from flask_jwt_extended import JWTManager
from flask_jwt_extended.config import config
from flask_jwt_extended.internal_utils import JSONEncoder


def get_package_version(package_name):
if sys.version_info >= (3, 8):
# Use importlib.metadata for Python 3.8 and newer
import importlib.metadata

return importlib.metadata.version(package_name)
else:
# Use pkg_resources for older versions
import pkg_resources

return pkg_resources.get_distribution(package_name).version


flask_version = get_package_version("flask")
flask_version_tuple = tuple(map(int, flask_version.split(".")))


Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ deps =
python-dateutil
types-python-dateutil
mypy
types-setuptools

[testenv:coverage]
commands =
Expand Down
Loading