From 1a81a97e9f988d16da047a7d9c971bef0c8eeb68 Mon Sep 17 00:00:00 2001 From: Hamdi Sahloul Date: Sat, 29 Sep 2018 19:34:44 +0900 Subject: [PATCH] Utilize the currently running Python executable especially if it matches the module being tested --- modules/ts/misc/run_suite.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/ts/misc/run_suite.py b/modules/ts/misc/run_suite.py index 2eaeae1c3f..a3c4be7546 100644 --- a/modules/ts/misc/run_suite.py +++ b/modules/ts/misc/run_suite.py @@ -1,6 +1,7 @@ #!/usr/bin/env python import os import re +import sys from run_utils import Err, log, execute, getPlatformVersion, isColorEnabled, TempEnvDir from run_long import LONG_TESTS_DEBUG_VALGRIND, longTestFilter @@ -116,6 +117,8 @@ class TestSuite(object): return None, ret elif module in ['python2', 'python3']: executable = os.getenv('OPENCV_PYTHON_BINARY', None) + if executable is None or module == 'python{}'.format(sys.version_info[0]): + executable = sys.executable if executable is None: executable = path if not self.tryCommand([executable, '--version'], workingDir):