Validate virtual environment while running a job/inventory update

Currently we only check the custom virtual environment path when
it's created. However, to tackle with the case when the venv might
have been changed/deleted afterward, we need to validate it at
run-time too.

Signed-off-by: Vismay Golwala <vgolwala@redhat.com>
This commit is contained in:
Vismay Golwala
2019-03-28 13:02:05 -04:00
committed by Ryan Petrello
parent 6d5897f371
commit 5d570a017a
3 changed files with 19 additions and 7 deletions

View File

@@ -525,10 +525,10 @@ class TestGenericRun():
job.project.custom_virtualenv = '/venv/missing'
task = tasks.RunJob()
with pytest.raises(RuntimeError) as e:
with pytest.raises(tasks.InvalidVirtualenvError) as e:
task.build_env(job, private_data_dir)
assert 'a valid Python virtualenv does not exist at /venv/missing' == str(e.value)
assert 'Invalid virtual environment selected: /venv/missing' == str(e.value)
class TestAdhocRun(TestJobExecution):