Browse Source

sahara-scenario: set PYTHON when starting the test

Make sure that the internally-generated test uses the same PYTHON
variable that started sahara-scenario. Otherwise, when running inside
a virtualenv, the python executable from the venv is not used.

This change allows us to enable again the Python 3 scenario test.
Change-Id: I42d16b4acf72ff279d6b31840e11f2e7f939b113
tags/0.9.1^0
Luigi Toscano 9 months ago
parent
commit
a225824efc
3 changed files with 13 additions and 2 deletions
  1. +2
    -2
      .zuul.yaml
  2. +5
    -0
      releasenotes/notes/sahara-scenario-fix-runner-59350d608d19caf9.yaml
  3. +6
    -0
      sahara_tests/scenario/utils.py

+ 2
- 2
.zuul.yaml View File

@@ -14,8 +14,7 @@
voting: false
- sahara-tests-scenario
- sahara-tests-scenario-v2
- sahara-tests-scenario-py3:
voting: false
- sahara-tests-scenario-py3
- sahara-tests-tempest
- sahara-tests-tempest-v2
- sahara-tests-scenario-rocky
@@ -26,6 +25,7 @@
jobs:
- sahara-tests-scenario
- sahara-tests-scenario-v2
- sahara-tests-scenario-py3
- sahara-tests-tempest
- sahara-tests-tempest-v2
experimental:


+ 5
- 0
releasenotes/notes/sahara-scenario-fix-runner-59350d608d19caf9.yaml View File

@@ -0,0 +1,5 @@
---
fixes:
- |
Fix a strange error where the internally generated test does not start
because sahara_tests.scenario is not found when running inside a virtualenv.

+ 6
- 0
sahara_tests/scenario/utils.py View File

@@ -60,6 +60,12 @@ def run_tests(concurrency, test_dir_path):
if concurrency:
command.extend(['--concurrency=%d' % concurrency])
new_env = os.environ.copy()
# Use the same python executable which has started sahara-scenario,
# if the PYTHON value has not been set explicitly.
# This is important whenever sahara-scenario is executed in a virtualenv
# or there are multiple Python versions around.
if not new_env.get('PYTHON', ''):
new_env['PYTHON'] = sys.executable
tester_runner = subprocess.Popen(command, env=new_env, cwd=test_dir_path)
tester_runner.communicate()
return tester_runner.returncode


Loading…
Cancel
Save