[PATCH][autotest-client-tests] UBUNTU: SAUCE: ubuntu_qrt_apparmor: on Groovy+, invoke the test using python3

Paolo Pisati paolo.pisati at canonical.com
Mon Sep 7 15:17:14 UTC 2020


BugLink: https://bugs.launchpad.net/bugs/1890771

Fix the:

The test will fail with:
  ImportError: No module named pexpect

error when invoked on Groovy+.

Signed-off-by: Paolo Pisati <paolo.pisati at canonical.com>
---
 ubuntu_qrt_apparmor/ubuntu_qrt_apparmor.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ubuntu_qrt_apparmor/ubuntu_qrt_apparmor.py b/ubuntu_qrt_apparmor/ubuntu_qrt_apparmor.py
index 27b5d1a1..c7a24dcc 100644
--- a/ubuntu_qrt_apparmor/ubuntu_qrt_apparmor.py
+++ b/ubuntu_qrt_apparmor/ubuntu_qrt_apparmor.py
@@ -78,7 +78,12 @@ class ubuntu_qrt_apparmor(test.test):
         if test_name == 'setup':
             return
 
-        cmd = 'python2 ./%s -v' % test_name
+        inter = 'python3'
+        series = platform.dist()[2]
+        if series in ['precise', 'trusty', 'xenial', 'bionic', 'focal']:
+            inter = 'python2'
+
+        cmd = '%s ./%s -v' % (inter, test_name)
         self.results = utils.system_output(cmd, retain_output=True)
 
 
-- 
2.25.1




More information about the kernel-team mailing list