Blob Blame History Raw
From 9b2db940621dd8fa75b38db54a704be7a9ab0062 Mon Sep 17 00:00:00 2001
From: Cleber Rosa <crosa@redhat.com>
Date: Fri, 20 Jul 2018 17:30:57 -0400
Subject: [PATCH] selftests/functional/test_basic.py: prevent unversioned
 Python

`examples/tests/simplewarning.sh` calls a generic avocado command,
which gets added to the path by the test code. That generic avocado
command is `scripts/avocado`, from the source repository, which
contains the unversioned `/usr/bin/env python`.

Under some environments, such as Fedora >= 29, there may be no
unversioned Python binary.  Let's respect the UNITTEST_AVOCADO_CMD
environment variable, and add the the directory containting that
binary to the PATH.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
 selftests/functional/test_basic.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/selftests/functional/test_basic.py b/selftests/functional/test_basic.py
index 7b7edbada..1f26f9db2 100644
--- a/selftests/functional/test_basic.py
+++ b/selftests/functional/test_basic.py
@@ -730,7 +730,9 @@ def test_simplewarning(self):
         simplewarning.sh uses the avocado-bash-utils
         """
         # simplewarning.sh calls "avocado" without specifying a path
-        os.environ['PATH'] += ":" + os.path.join(basedir, 'scripts')
+        # let's add the path that was defined at the global module
+        # scope here
+        os.environ['PATH'] += ":" + os.path.dirname(AVOCADO)
         # simplewarning.sh calls "avocado exec-path" which hasn't
         # access to an installed location for the libexec scripts
         os.environ['PATH'] += ":" + os.path.join(basedir, 'libexec')