From 6b9c534658bb8c8c7a4bfcbfda950cf6eda316ab Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Thu, 3 Dec 2015 17:24:53 -0500 Subject: [PATCH] add api-samples tox target api-samples generation is no longer straight forward, now that tox is blocking environment changes, and that PYTHONHASHSEED is randomized in each run. This creates a tox target to make it easy to generate the api-samples. Change-Id: Ie88597fecee5ce81fb29ce2cfb73b15d60f3f389 --- nova/tests/functional/api_sample_tests/README.rst | 4 ++-- tox.ini | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/nova/tests/functional/api_sample_tests/README.rst b/nova/tests/functional/api_sample_tests/README.rst index 55e038a6f61b..2ada29481113 100644 --- a/nova/tests/functional/api_sample_tests/README.rst +++ b/nova/tests/functional/api_sample_tests/README.rst @@ -7,11 +7,11 @@ tests in this directory. To add a new api sample, add tests for the common passing and failing cases in this directory for your extension, and modify test_samples.py -for your tests. There should be both JSON and XML tests included. +for your tests. Then run the following command: - GENERATE_SAMPLES=True tox -e functional + tox -e api-samples Which will create the files on doc/api_samples. diff --git a/tox.ini b/tox.ini index 17172ad43567..ab4397a237f7 100644 --- a/tox.ini +++ b/tox.ini @@ -66,6 +66,18 @@ commands = find . -type f -name "*.pyc" -delete bash tools/pretty_tox.sh '{posargs}' +[testenv:api-samples] +usedevelop = True +install_command = pip install -U --force-reinstall {opts} {packages} +setenv = VIRTUAL_ENV={envdir} + GENERATE_SAMPLES=True + PYTHONHASHSEED=0 + OS_TEST_PATH=./nova/tests/functional/api_sample_tests + LANGUAGE=en_US +commands = + find . -type f -name "*.pyc" -delete + bash tools/pretty_tox.sh '{posargs}' + [testenv:functional-constraints] usedevelop = {[testenv:functional]usedevelop} install_command = {[testenv:common-constraints]install_command}