Use pkg_resources to get the package version instead of vcversioner
This commit is contained in:
parent
af04129d79
commit
62dc4dc257
5 changed files with 14 additions and 6 deletions
|
@ -10,6 +10,12 @@ import pkg_resources
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
try:
|
||||
__version__ = pkg_resources.get_distribution('swh.lister').version
|
||||
except pkg_resources.DistributionNotFound:
|
||||
__version__ = 'devel'
|
||||
|
||||
|
||||
LISTERS = {entry_point.name.split('.', 1)[1]: entry_point
|
||||
for entry_point in pkg_resources.iter_entry_points('swh.workers')
|
||||
if entry_point.name.split('.', 1)[0] == 'lister'}
|
||||
|
|
|
@ -14,10 +14,7 @@ import xmltodict
|
|||
|
||||
from typing import Optional, Union
|
||||
|
||||
try:
|
||||
from swh.lister._version import __version__
|
||||
except ImportError:
|
||||
__version__ = 'devel'
|
||||
from swh.lister import __version__
|
||||
|
||||
from .abstractattribute import AbstractAttribute
|
||||
from .lister_base import FetchError
|
||||
|
|
|
@ -12,6 +12,7 @@ import requests_mock
|
|||
from sqlalchemy import create_engine
|
||||
from typing import Any, Callable, Optional, Pattern, Type, Union
|
||||
|
||||
import swh.lister
|
||||
from swh.lister.core.abstractattribute import AbstractAttribute
|
||||
from swh.lister.tests.test_utils import init_db
|
||||
|
||||
|
@ -20,6 +21,11 @@ def noop(*args, **kwargs):
|
|||
pass
|
||||
|
||||
|
||||
def test_version_generation():
|
||||
assert swh.lister.__version__ != 'devel', \
|
||||
"Make sure swh.lister is installed (e.g. pip install -e .)"
|
||||
|
||||
|
||||
class HttpListerTesterBase(abc.ABC):
|
||||
"""Testing base class for listers.
|
||||
This contains methods for both :class:`HttpSimpleListerTester` and
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue