File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 11import sys
22import warnings
3- import pkg_resources
3+ try :
4+ import importlib .metadata as importlib_metadata
5+ except ImportError :
6+ import importlib_metadata
47
58try :
6- __version__ = pkg_resources . require ('python-dispatch' )[ 0 ]. version
9+ __version__ = importlib_metadata . version ('python-dispatch' )
710except : # pragma: no cover
811 __version__ = 'unknown'
912
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ license_file = LICENSE.txt
1616keywords = event properties dispatch
1717platforms = any
1818python_requires = >=3.6
19+ install_requires =
20+ importlib_metadata; python_version<'3.8'
1921classifiers =
2022 Development Status :: 3 - Alpha
2123 Intended Audience :: Developers
Original file line number Diff line number Diff line change 1+
2+ from pathlib import Path
3+ from setuptools .config import read_configuration
4+
5+
6+ PROJECT_ROOT = Path (__file__ ).parent .parent .resolve ()
7+ SETUP_CFG = PROJECT_ROOT / 'setup.cfg'
8+
9+ def get_expected_version (config_file : Path = SETUP_CFG ) -> str :
10+ conf_dict = read_configuration (str (config_file ))
11+ return conf_dict ['metadata' ]['version' ]
12+
13+ EXPECTED_VERSION = get_expected_version ()
14+
15+
16+ def test_version ():
17+ import pydispatch
18+ assert pydispatch .__version__ == EXPECTED_VERSION
You can’t perform that action at this time.
0 commit comments