mirror of
https://github.com/ansible/awx.git
synced 2026-05-18 06:47:41 -02:30
Skip proot test if proot is not installed.
This commit is contained in:
@@ -6,6 +6,7 @@ from distutils.version import StrictVersion as Version
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
@@ -1331,6 +1332,17 @@ class RunJobTest(BaseCeleryTest):
|
|||||||
self.check_job_events(job, 'ok', 1, 3, has_roles=True)
|
self.check_job_events(job, 'ok', 1, 3, has_roles=True)
|
||||||
|
|
||||||
def test_run_job_with_proot(self):
|
def test_run_job_with_proot(self):
|
||||||
|
# Only run test if proot is installed
|
||||||
|
cmd = [getattr(settings, 'AWX_PROOT_CMD', 'proot'), '--version']
|
||||||
|
try:
|
||||||
|
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE)
|
||||||
|
result = proc.communicate()
|
||||||
|
has_proot = bool(proc.returncode == 0)
|
||||||
|
except (OSError, ValueError):
|
||||||
|
has_proot = False
|
||||||
|
if not has_proot:
|
||||||
|
self.skipTest('proot is not installed')
|
||||||
# Enable proot for this test.
|
# Enable proot for this test.
|
||||||
settings.AWX_PROOT_ENABLED = True
|
settings.AWX_PROOT_ENABLED = True
|
||||||
# Hide local settings path.
|
# Hide local settings path.
|
||||||
|
|||||||
Reference in New Issue
Block a user