diff --git a/tox.ini b/tox.ini --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist=black,flake8,mypy,py3,identify +envlist=black,flake8,mypy,py3,identify,identify-base [testenv] extras = @@ -21,6 +21,25 @@ commands = pytest {envsitepackagesdir}/swh/model/tests/test_cli.py +[testenv:identify-base] +# Tests swh-identify works even with the bare minimum of dependencies install +# (eg. no dulwich) +extras = +deps = + Click + pytest +commands = + # Run all tests that don't depend on dulwich: + pytest {envsitepackagesdir}/swh/model/tests/test_cli.py -k 'not snapshot' + # Check we get a nice error if we depend on dulwich: + /usr/bin/env bash -c " \ + # run swh-identify, should have non-zero exit code (ie. error) + ! swh-identify -t snapshot . 2>&1 \ + # check the output contains the error message + | (! grep 'Dulwich package') \ + > /dev/null \ + " + [testenv:black] skip_install = true deps =