diff --git a/swh/model/cli.py b/swh/model/cli.py --- a/swh/model/cli.py +++ b/swh/model/cli.py @@ -11,7 +11,12 @@ # control import click -from swh.core.cli import swh as swh_cli_group +try: + from swh.core.cli import swh as swh_cli_group +except ImportError: + # stub so that swh-identify can be used when swh-core isn't installed + swh_cli_group = click # type: ignore + from swh.model.identifiers import CoreSWHID, ObjectType CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"]) diff --git a/tox.ini b/tox.ini --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist=black,flake8,mypy,py3 +envlist=black,flake8,mypy,py3,identify [testenv] extras = @@ -12,6 +12,15 @@ {envsitepackagesdir}/swh/model \ --cov-branch {posargs} +[testenv:identify] +# no 'extras = testing', as it would install swh-core; +# and this test is designed to check 'swh-identify' does not depend on swh-core. +extras = +deps = + -r requirements-test.txt +commands = + pytest {envsitepackagesdir}/swh/model/tests/test_cli.py + [testenv:black] skip_install = true deps =