diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7039acc..ba4752f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,13 +10,13 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4.5.0 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/weekly.yml b/.github/workflows/weekly.yml index b209e52..e1211aa 100644 --- a/.github/workflows/weekly.yml +++ b/.github/workflows/weekly.yml @@ -15,7 +15,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v3 diff --git a/requirements.txt b/requirements.txt index 15baa2e..c4b8ca9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,8 @@ editdistpy>=0.1.3 # For testing -coverage==6.1.2 +coverage==7.4.4 +importlib-resources>=6.3.2 numpy>=1.19.5 -pytest-cov==3.0.0 +pytest==8.1.1 +pytest-cov==4.1.0 diff --git a/setup.cfg b/setup.cfg index b46fa02..5e20998 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,16 +19,17 @@ classifiers = License :: OSI Approved :: MIT License Programming Language :: Python Programming Language :: Python :: 3 - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 [options] zip_safe = False include_package_data = True packages = find: -python_requires = >=3.7 +python_requires = >=3.8 install_requires = editdistpy>=0.1.3 diff --git a/tests/conftest.py b/tests/conftest.py index 4d5593e..3669444 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,7 +1,7 @@ import json from pathlib import Path -import pkg_resources +import importlib_resources import pytest from symspellpy import SymSpell @@ -13,17 +13,15 @@ ####################################################################### @pytest.fixture def bigram_path(): - return pkg_resources.resource_filename( - "symspellpy", "frequency_bigramdictionary_en_243_342.txt" - ) - + ref = importlib_resources.files("symspellpy") / "frequency_bigramdictionary_en_243_342.txt" + with importlib_resources.as_file(ref) as path: + yield path @pytest.fixture def dictionary_path(): - return pkg_resources.resource_filename( - "symspellpy", "frequency_dictionary_en_82_765.txt" - ) - + ref = importlib_resources.files("symspellpy") / "frequency_dictionary_en_82_765.txt" + with importlib_resources.as_file(ref) as path: + yield path @pytest.fixture def pickle_path(): @@ -90,3 +88,4 @@ def symspell_short(request): if request.param is None: return SymSpell(1, 3) return SymSpell(1, 3, count_threshold=request.param) + diff --git a/tests/test_editdistance.py b/tests/test_editdistance.py index 9692533..65d8a03 100644 --- a/tests/test_editdistance.py +++ b/tests/test_editdistance.py @@ -20,7 +20,7 @@ def expected_levenshtein(string_1, string_2, max_distance): - max_distance = int(min(2 ** 31 - 1, max_distance)) + max_distance = int(min(2**31 - 1, max_distance)) len_1 = len(string_1) len_2 = len(string_2) d = np.zeros((len_1 + 1, len_2 + 1)) @@ -42,7 +42,7 @@ def expected_levenshtein(string_1, string_2, max_distance): def expected_damerau_osa(string_1, string_2, max_distance): - max_distance = int(min(2 ** 31 - 1, max_distance)) + max_distance = int(min(2**31 - 1, max_distance)) len_1 = len(string_1) len_2 = len(string_2) d = np.zeros((len_1 + 1, len_2 + 1)) @@ -145,10 +145,9 @@ def test_abstract_distance_comparer(self): with pytest.raises(TypeError) as excinfo: comparer = AbstractDistanceComparer() _ = comparer.distance("string_1", "string_2", 10) - assert ( - "Can't instantiate abstract class AbstractDistanceComparer with " - f"abstract method{'s' if sys.version_info[1] < 9 else ''} distance" - ) == str(excinfo.value) + assert str(excinfo.value).startswith( + "Can't instantiate abstract class AbstractDistanceComparer" + ) def test_internal_distance_comparer(self, get_edit_distance): edit_distance, expected = get_edit_distance