Skip to content

Commit

Permalink
Replace pkg_resources in test_load (#1870)
Browse files Browse the repository at this point in the history
Replace pkg_resources.resource_filename with importlib.resources.files.
This removes an implicit dependency on setuptools (to which
pkg_resources belongs); furthermore, the entire pkg_resources API is
deprecated.

Regarding the switch from __file__ to __package__, see:
python/importlib_resources#60
  • Loading branch information
musicinmybrain authored Dec 3, 2023
1 parent 321ea75 commit 37127e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pint/testsuite/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,11 @@ def test_define(self):
assert len(dir(ureg)) > 0

def test_load(self):
import pkg_resources
from importlib.resources import files

from .. import compat

data = pkg_resources.resource_filename(compat.__name__, "default_en.txt")
data = files(compat.__package__).joinpath("default_en.txt")
ureg1 = UnitRegistry()
ureg2 = UnitRegistry(data)
assert dir(ureg1) == dir(ureg2)
Expand Down

0 comments on commit 37127e1

Please sign in to comment.