aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2020-09-05 16:24:37 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2021-02-09 14:26:11 +0100
commit73cf74c5700db716a45015758ca5f5b6f47ec00f (patch)
tree50f3fb4cff5538dcf929a885d1cc9615a2aaf6ba
parent3116e9fd45e788d48e7eb04e96d7b3a6d94012f3 (diff)
Protect mts vs py2
Change-Id: I7a9aa9267a81161b10b1d625efbaa924187f8690 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit cd0f0900cb9290f2e84ad184842d8d8ce543a2e7)
-rw-r--r--xtesting/core/mts.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/xtesting/core/mts.py b/xtesting/core/mts.py
index a5cc6a1d..0c861e90 100644
--- a/xtesting/core/mts.py
+++ b/xtesting/core/mts.py
@@ -24,6 +24,7 @@ import time
from lxml import etree
import prettytable
+import six
from xtesting.core import testcase
@@ -227,14 +228,17 @@ class MTSLauncher(testcase.TestCase):
if console:
sys.stdout.write(line.decode("utf-8"))
f_stdout.write(line.decode("utf-8"))
- try:
- process.wait(timeout=max_duration)
- except subprocess.TimeoutExpired:
- process.kill()
- self.__logger.info(
- "Killing MTS process after %d second(s).",
- max_duration)
- return 3
+ if six.PY3:
+ try:
+ process.wait(timeout=max_duration)
+ except subprocess.TimeoutExpired:
+ process.kill()
+ self.__logger.info(
+ "Killing MTS process after %d second(s).",
+ max_duration)
+ return 3
+ else:
+ process.wait()
with open(self.result_file, 'r') as f_stdin:
self.__logger.debug("$ %s\n%s", cmd, f_stdin.read().rstrip())
return process.returncode