Add convenience environment to re-record tests
tox.ini's command specification doesn't expand globs (*) so one cannot
simply do:
rm {posargs:cratonclient/tests/cassettes/*.yaml}
Instead one must be tricky and use find as we do in this commit. This
also allows folks to simply re-record only the cassettes they wish to
rerecord by doing
tox -e rerecord -- TestHosts-test_create.yaml
As it will then execute
find cratonclient/tests/cassettes -name 'TestHosts-test_create' \
-delete
Or even use globs
tox -e rerecord -- 'TestHosts*'
As that will translate to
find cratonclient/tests/cassettes -name 'TestHosts*' -delete
This also ensures that new tests aren't recorded in our py27/py35
environments by setting the appropriate environment variable. Only the
rerecord environment may now record new cassettes.
Change-Id: I64e322548afc1b2d508fa129c0b151a8a91137a0
This commit is contained in:
10
tox.ini
10
tox.ini
@@ -10,6 +10,7 @@ setenv =
|
|||||||
VIRTUAL_ENV={envdir}
|
VIRTUAL_ENV={envdir}
|
||||||
BRANCH_NAME=master
|
BRANCH_NAME=master
|
||||||
CLIENT_NAME=python-cratonclient
|
CLIENT_NAME=python-cratonclient
|
||||||
|
BETAMAX_RECORD_MODE=none
|
||||||
passenv = BETAMAX_* CRATON_*
|
passenv = BETAMAX_* CRATON_*
|
||||||
deps =
|
deps =
|
||||||
-r{toxinidir}/requirements.txt
|
-r{toxinidir}/requirements.txt
|
||||||
@@ -24,6 +25,15 @@ commands =
|
|||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
|
|
||||||
|
[testenv:rerecord]
|
||||||
|
setenv=
|
||||||
|
BETAMAX_RECORD_MODE=once
|
||||||
|
whitelist_externals =
|
||||||
|
find
|
||||||
|
commands =
|
||||||
|
find cratonclient/tests/cassettes/ -name '{posargs:*.yaml}' -delete
|
||||||
|
python setup.py test --slowest --testr-args='--concurrency=1'
|
||||||
|
|
||||||
[testenv:cover]
|
[testenv:cover]
|
||||||
commands = python setup.py test --coverage --testr-args='{posargs}'
|
commands = python setup.py test --coverage --testr-args='{posargs}'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user