From f7abac3feada4a5b0f79e403ba15d29cacb07329 Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Wed, 22 Mar 2017 10:30:47 -0500 Subject: [PATCH] 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 --- tox.ini | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tox.ini b/tox.ini index a96fb79..10e4acf 100644 --- a/tox.ini +++ b/tox.ini @@ -10,6 +10,7 @@ setenv = VIRTUAL_ENV={envdir} BRANCH_NAME=master CLIENT_NAME=python-cratonclient + BETAMAX_RECORD_MODE=none passenv = BETAMAX_* CRATON_* deps = -r{toxinidir}/requirements.txt @@ -24,6 +25,15 @@ commands = [testenv:venv] 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] commands = python setup.py test --coverage --testr-args='{posargs}'