Blob Blame History Raw
From d86a844a5fb92d9de6f224a7c44903ffb5cba5ca Mon Sep 17 00:00:00 2001
From: Merlin Mathesius <mmathesi@redhat.com>
Date: Tue, 17 Jul 2018 16:55:34 -0500
Subject: [PATCH] Fix scripts to explicitly use proper version of Python.

Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
---
 selftests/functional/test_skiptests.py | 4 ++--
 selftests/functional/test_utils.py     | 8 ++++----
 selftests/run                          | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/selftests/functional/test_skiptests.py b/selftests/functional/test_skiptests.py
index f82ad610e..70ecdc10a 100644
--- a/selftests/functional/test_skiptests.py
+++ b/selftests/functional/test_skiptests.py
@@ -127,7 +127,7 @@ def test_skip_decorators(self):
 
     def test_skip_setup(self):
         os.chdir(basedir)
-        cmd_line = ['./scripts/avocado',
+        cmd_line = [AVOCADO,
                     'run',
                     '--sysinfo=off',
                     '--job-results-dir',
@@ -141,7 +141,7 @@ def test_skip_setup(self):
 
     def test_skip_teardown(self):
         os.chdir(basedir)
-        cmd_line = ['./scripts/avocado',
+        cmd_line = [AVOCADO,
                     'run',
                     '--sysinfo=off',
                     '--job-results-dir',
diff --git a/selftests/functional/test_utils.py b/selftests/functional/test_utils.py
index 33fbd5334..8b74a546f 100644
--- a/selftests/functional/test_utils.py
+++ b/selftests/functional/test_utils.py
@@ -20,7 +20,7 @@
                 stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP |
                 stat.S_IROTH | stat.S_IXOTH)
 
-FAKE_VMSTAT_CONTENTS = """#!/usr/bin/env python
+FAKE_VMSTAT_CONTENTS = """#!{python}
 import time
 import random
 import signal
@@ -115,13 +115,13 @@ def start(self):
 if __name__ == '__main__':
     vmstat = FakeVMStat(interval=float(sys.argv[1]))
     vmstat.start()
-"""
+""".format(python=sys.executable)
 
-FAKE_UPTIME_CONTENTS = """#!/usr/bin/env python
+FAKE_UPTIME_CONTENTS = """#!{python}
 if __name__ == '__main__':
     print("17:56:34 up  8:06,  7 users,  load average: 0.26, 0.20, 0.21")
 
-"""
+""".format(python=sys.executable)
 
 
 class ProcessTest(unittest.TestCase):
diff --git a/selftests/run b/selftests/run
index 0a165ccb4..bd2639446 100755
--- a/selftests/run
+++ b/selftests/run
@@ -59,7 +59,7 @@ class MyResult(unittest.TextTestResult):
                          stdout=subprocess.PIPE,
                          stderr=subprocess.PIPE).communicate()
         # ... and check whether some dirs were left behind
-        dir_check = subprocess.Popen([CHECK_TMP_DIRS], stdout=subprocess.PIPE,
+        dir_check = subprocess.Popen([sys.executable, CHECK_TMP_DIRS], stdout=subprocess.PIPE,
                                      stderr=subprocess.STDOUT)
         if dir_check.wait():
             raise AssertionError("Test %s left some tmp files behind:\n%s"