Prefer to invoke scripts directly without python.

When executing scripts with a "python" prefix like tox does here, the
directory containing the script is put on the Python path. This is a
problem if any module or file in that directory has the same name as a
Python standard library module, as it means that the module in
elastic-recheck will "shadow" the module in the standard library and be
imported in preference to the stdlib version.

In the case of elastic-recheck, this means that tox -e run does not
actually work: the elastic_recheck.cmd module shadows the stdlib cmd
module, and a long import chain ends up importing pdb which imports the
stdlib cmd module. This ends up causing an AttributeError, leaving the
run environment useless.

However, the script that the run environment wants to invoke is already
installed into the virtual environment by pbr, which means we can simply
invoke it directly and virtualenv will ensure that the correct binary is
invoked.

Change-Id: I6dec4ae58ab10f44c92f94ddb531e6d278d01451
Signed-off-by: Cory Benfield <cory.benfield@hpe.com>
This commit is contained in:
Cory Benfield 2016-09-28 18:17:40 +01:00
parent 9847d7aa35
commit 5b632bc2db
No known key found for this signature in database
GPG Key ID: 70FE17F8A643E15B
1 changed files with 1 additions and 1 deletions

View File

@ -29,7 +29,7 @@ commands = python setup.py testr --coverage --coverage-package-name='elastic_rec
[testenv:run]
# test to run the bot as a non voting foreground process
commands = python elastic_recheck/bot.py -f -n --noirc elasticRecheck.conf
commands = elastic-recheck -f -n --noirc elasticRecheck.conf
[flake8]
# H233 Skipped because don't support python3 yet