Skip to content

Commit 47b235c

Browse files
authored
Merge pull request #62 from s-t-e-v-e-n-k/remove-pkg_resources
Switch to using importlib.metadata
2 parents 7ae853f + 3f0ef22 commit 47b235c

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

tests/test_core.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# coding: utf-8
22
"""Core tests for wcwidth module."""
33
# 3rd party
4-
import pkg_resources
4+
try:
5+
import importlib.metadata as importmeta
6+
except ImportError:
7+
import importlib_metadata as importmeta
58

69
# local
710
import wcwidth
@@ -10,7 +13,7 @@
1013
def test_package_version():
1114
"""wcwidth.__version__ is expected value."""
1215
# given,
13-
expected = pkg_resources.get_distribution('wcwidth').version
16+
expected = importmeta.version('wcwidth')
1417

1518
# exercise,
1619
result = wcwidth.__version__

tests/test_ucslevel.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
# 3rd party
77
import pytest
8-
import pkg_resources
98

109
# local
1110
import wcwidth

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ skip_missing_interpreters = true
55
[testenv]
66
deps = pytest==4.6.10
77
pytest-cov==2.8.1
8+
importlib_metadata; python_version < '3.8'
89
commands = {envpython} -m pytest --cov-config={toxinidir}/tox.ini {posargs:\
910
--strict --verbose \
1011
--junit-xml=.tox/results.{envname}.xml \

0 commit comments

Comments
 (0)