test/crossrunner: merge in old Py2vs3 compat.py
diff --git a/test/crossrunner/report.py b/test/crossrunner/report.py
index 7e1b0c7..9231a8b 100644
--- a/test/crossrunner/report.py
+++ b/test/crossrunner/report.py
@@ -28,7 +28,6 @@
import time
import traceback
-from .compat import logfile_open, path_join, str_join
from .test import TestEntry
LOG_DIR = 'log'
@@ -37,6 +36,10 @@
FAIL_JSON = 'known_failures_%s.json'
+def logfile_open(*args):
+ return open(*args, errors='replace')
+
+
def generate_known_failures(testdir, overwrite, save, out):
def collect_failures(results):
success_index = 5
@@ -44,7 +47,7 @@
if not r[success_index]:
yield TestEntry.get_name(*r)
try:
- with logfile_open(path_join(testdir, RESULT_JSON), 'r') as fp:
+ with logfile_open(os.path.join(testdir, RESULT_JSON), 'r') as fp:
results = json.load(fp)
except IOError:
sys.stderr.write('Unable to load last result. Did you run tests ?\n')
@@ -67,7 +70,7 @@
def load_known_failures(testdir):
try:
- with logfile_open(path_join(testdir, FAIL_JSON % platform.system()), 'r') as fp:
+ with logfile_open(os.path.join(testdir, FAIL_JSON % platform.system()), 'r') as fp:
return json.load(fp)
except IOError:
return []
@@ -84,8 +87,8 @@
@classmethod
def test_logfile(cls, test_name, prog_kind, dir=None):
- relpath = path_join('log', '%s_%s.log' % (test_name, prog_kind))
- return relpath if not dir else os.path.realpath(path_join(dir, relpath))
+ relpath = os.path.join('log', '%s_%s.log' % (test_name, prog_kind))
+ return relpath if not dir else os.path.realpath(os.path.join(dir, relpath))
def _start(self):
self._start_time = time.time()
@@ -199,7 +202,7 @@
def _print_header(self):
self._print_date()
- print('Executing: %s' % str_join(' ', self._prog.command), file=self.out)
+ print('Executing: %s' % ' '.join(self._prog.command), file=self.out)
print('Directory: %s' % self._prog.workdir, file=self.out)
print('config:delay: %s' % self._test.delay, file=self.out)
print('config:timeout: %s' % self._test.timeout, file=self.out)
@@ -221,8 +224,8 @@
super(SummaryReporter, self).__init__()
self._basedir = basedir
self._testdir_rel = testdir_relative
- self.logdir = path_join(self.testdir, LOG_DIR)
- self.out_path = path_join(self.testdir, RESULT_JSON)
+ self.logdir = os.path.join(self.testdir, LOG_DIR)
+ self.out_path = os.path.join(self.testdir, RESULT_JSON)
self.concurrent = concurrent
self.out = sys.stdout
self._platform = platform.system()
@@ -239,7 +242,7 @@
@property
def testdir(self):
- return path_join(self._basedir, self._testdir_rel)
+ return os.path.join(self._basedir, self._testdir_rel)
def _result_string(self, test):
if test.success: