summaryrefslogtreecommitdiffstats
path: root/support
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2017-07-11 19:40:07 -0700
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2017-07-22 22:53:27 +0200
commitded5fa305985dff1585b1632697d2ee7297300b1 (patch)
treeb7b80dfb3473ef0418a5163eb1e7d1b40e11dda9 /support
parent97278ebddda2e757d71b092b063f04e9f748223c (diff)
downloadbuildroot-ded5fa305985dff1585b1632697d2ee7297300b1.tar.gz
buildroot-ded5fa305985dff1585b1632697d2ee7297300b1.zip
testing/tests/package/test_python: do not hardcode interpreter name
In order to be able to leverage the same test code for testing different python interpreters (or wrappers around CPython) allow child classes of TestPythonBase to override the name of the executable used to run tests. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'support')
-rw-r--r--support/testing/tests/package/test_python.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/support/testing/tests/package/test_python.py b/support/testing/tests/package/test_python.py
index 218235b442..a3ec31b330 100644
--- a/support/testing/tests/package/test_python.py
+++ b/support/testing/tests/package/test_python.py
@@ -8,6 +8,8 @@ class TestPythonBase(infra.basetest.BRTest):
BR2_TARGET_ROOTFS_CPIO=y
# BR2_TARGET_ROOTFS_TAR is not set
"""
+ interpreter = "python"
+
def login(self):
cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
self.emulator.boot(arch="armv5",
@@ -16,17 +18,17 @@ BR2_TARGET_ROOTFS_CPIO=y
self.emulator.login()
def version_test(self, version):
- cmd = "python --version 2>&1 | grep '^{}'".format(version)
+ cmd = self.interpreter + " --version 2>&1 | grep '^{}'".format(version)
_, exit_code = self.emulator.run(cmd)
self.assertEqual(exit_code, 0)
def math_floor_test(self):
- cmd = "python -c 'import math; math.floor(12.3)'"
+ cmd = self.interpreter + " -c 'import math; math.floor(12.3)'"
_, exit_code = self.emulator.run(cmd)
self.assertEqual(exit_code, 0)
def libc_time_test(self):
- cmd = "python -c 'from __future__ import print_function;"
+ cmd = self.interpreter + " -c 'from __future__ import print_function;"
cmd += "import ctypes;"
cmd += "libc = ctypes.cdll.LoadLibrary(\"libc.so.1\");"
cmd += "print(libc.time(None))'"
@@ -34,7 +36,7 @@ BR2_TARGET_ROOTFS_CPIO=y
self.assertEqual(exit_code, 0)
def zlib_test(self):
- cmd = "python -c 'import zlib'"
+ cmd = self.interpreter + " -c 'import zlib'"
_, exit_code = self.emulator.run(cmd)
self.assertEqual(exit_code, 1)
OpenPOWER on IntegriCloud