diff --git a/requirements.txt b/requirements.txt index 15baa2e..266dd10 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,4 @@ editdistpy>=0.1.3 coverage==6.1.2 numpy>=1.19.5 pytest-cov==3.0.0 +importlib-resources>=6.3.2 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) +