run_tests does not support re-locating venv directory

Bug #1116942 reported by Chet Burgess
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Chet Burgess

Bug Description

run_tests currently requires that the virtual environment (venv) be located at ./.venv.

There are some use cases where having the virtual environment stored in the same directory as the repo is not desirable. For example if the repo is checked out on an NFS mount you cannot successfully install Cheetah in the virtual environment.

With minor effort we can support re-loacting the virtual environment to a different location.

Chet Burgess (cfb-n)
Changed in nova:
assignee: nobody → Chet Burgess (cfb-n)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/21286

iopenstack (drdanhe)
Changed in nova:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/21286
Committed: http://github.com/openstack/nova/commit/4c891b9243985bb95d8beff8affa9db470a1c94a
Submitter: Jenkins
Branch: master

commit 4c891b9243985bb95d8beff8affa9db470a1c94a
Author: Chet Burgess <email address hidden>
Date: Wed Feb 6 04:36:34 2013 +0000

    support reloctable venv roots in testing framework

    run_tests.sh, with_venv.sh, and the install_venv.py scripts now
    support relocating the venv root to another location.

    All 3 scripts now support new envinroment variables to configure
    the location of the venv and the tools directory. To maintain
    compatability the defaults are set to the current values.

    venv_path = Location of the virtualenv directory
     Default: $(pwd)

    venv_name = Name of the virtualenv directory
     Default: .venv

    tools_path = Location of the tools directory
     Default: $(pwd)

    Additionally the run_tests.sh script also takes these value as
    arguments and will pass them along accordingly.

    --virtual-env-path <path> Location of the virtualenv directory
                                 Default: $(pwd)
    --virtual-env-name <name> Name of the virtualenv directory
                                 Default: .venv
    --tools-path <dir> Location of the tools directory
                                 Default: $(pwd)

    DocImpact

    Change-Id: I1be036058227206ecca342f692cd3d6aadb24069
    Fixes: bug #1116942

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
Jean-Marc Saffroy (jean-marc-saffroy) wrote :
Download full text (3.3 KiB)

This change breaks the following use case:

#############

stack@vm:~/nova$ ./run_tests.sh -V test_libvirt_volume
Running `tools/with_venv.sh python setup.py testr --slowest --testr-args='--subunit -V'`
running testr
Usage: setup.py run [options] testfilters* doubledash? testargs*

Run the tests for a project and load them into testrepository.

Configuring via .testr.conf:
---
[DEFAULT]
test_command=foo $IDOPTION
test_id_option=--bar $IDFILE
---
will cause 'testr run' to run 'foo' to execute tests, and
'testr run --failing' will cause 'foo --bar failing.list ' to be run to
execute tests. Shell variables are expanded in these commands on platforms
that have a shell.

The full list of options and variables for .testr.conf:
* filter_tags -- a list of tags which should be used to filter test counts.
  This is useful for stripping out non-test results from the subunit stream
  such as Zope test layers. These filtered items are still considered for
  test failures.
* test_command -- command line to run to execute tests.
* test_id_option -- the value to substitute into test_command when specific
  test ids should be run.
* test_id_list_default -- the value to use for $IDLIST when no specific
  test ids are being run.
* test_list_option -- the option to use to cause the test runner to report
  on the tests it would run, rather than running them. When supplied the
  test_command should output on stdout all the test ids that would have
  been run if every other option and argument was honoured, one per line.
  This is required for parallel testing, and is substituted into $LISTOPT.
* test_run_concurrency -- Optional call out to establish concurrency.
  Should return one line containing the number of concurrent test runner
  processes to run.
* instance_provision -- provision one or more test run environments.
  Accepts $INSTANCE_COUNT for the number of instances desired.
* instance_execute -- execute a test runner process in a given environment.
  Accepts $INSTANCE_ID, $FILES and $COMMAND. Paths in $FILES should be
  synchronised into the test runner environment filesystem. $COMMAND can
  be adjusted if the paths are synched with different names.
* instance_dispose -- dispose of one or more test running environments.
  Accepts $INSTANCE_IDS.
* $IDOPTION -- the variable to use to trigger running some specific tests.
* $IDFILE -- A file created before the test command is run and deleted
  afterwards which contains a list of test ids, one per line. This can
  handle test ids with emedded whitespace.
* $IDLIST -- A list of the test ids to run, separated by spaces. IDLIST
  defaults to an empty string when no test ids are known and no explicit
  default is provided. This will not handle test ids with spaces.

See the testrepository manual for example .testr.conf files in different
programming languages.

setup.py: error: no such option: -V

----------------------------------------------------------------------
Ran 0 tests in 0.521s

OK

#############

Suggested fix:

diff --git a/run_tests.sh b/run_tests.sh
index 1f269fb..fd09ce7 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -57,8 +57,8 @@ function process_options {
         (( i++ ))
         tools_pa...

Read more...

Revision history for this message
Chet Burgess (cfb-n) wrote :

Jean-Marc,

Great catch. I've submitted your fix. Thank you.

Thierry Carrez (ttx)
Changed in nova:
milestone: none → grizzly-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: grizzly-3 → 2013.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.