From bfb7a1a6a99ab070eef56cad87151301c7b77cf3 Mon Sep 17 00:00:00 2001 From: Juho Inkinen Date: Mon, 21 Feb 2022 16:32:40 +0200 Subject: [PATCH] Resolve DeprecationWarning by pkg_resources by switching to importlib_metadata "Creating a LegacyVersion has been deprecated and will be removed in the next major release" --- setup.py | 3 ++- tests/test_cli.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 7cd924ee2..d998e78aa 100644 --- a/setup.py +++ b/setup.py @@ -56,7 +56,8 @@ def read(fname): 'pytest-flask', 'pytest-flake8', 'bumpversion', - 'autopep8' + 'autopep8', + 'importlib_metadata' ] }, entry_points={ diff --git a/tests/test_cli.py b/tests/test_cli.py index 9ade22941..aa5c38539 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -4,7 +4,7 @@ import random import re import os.path -import pkg_resources +import importlib_metadata import json from click.testing import CliRunner import annif.cli @@ -806,5 +806,5 @@ def test_version_option(): annif.cli.cli, ['--version']) assert not result.exception assert result.exit_code == 0 - version = pkg_resources.require('annif')[0].version + version = importlib_metadata.version('annif') assert result.output.strip() == version.strip()