Skip to content

Commit

Permalink
Replace pkg_resources in test_load
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 committed Oct 31, 2023
1 parent f9e139e commit 3f8a048
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 @@ -293,11 +293,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 3f8a048

Please sign in to comment.