diff --git a/modules/test/pyext/src/__init__.py b/modules/test/pyext/src/__init__.py index 3acf7c5c22..44cd9c1a4f 100644 --- a/modules/test/pyext/src/__init__.py +++ b/modules/test/pyext/src/__init__.py @@ -787,10 +787,13 @@ def __init__(self, stream=None, descriptions=None, verbosity=None): def stopTestRun(self): if 'IMP_TEST_DETAIL_DIR' in os.environ: + # Various parts of the IMP build pipeline use Python 3.6, + # which predates pickle protocol 5 + protocol = min(pickle.HIGHEST_PROTOCOL, 4) fname = (Path(os.environ['IMP_TEST_DETAIL_DIR']) / Path(sys.argv[0]).name) with open(str(fname), 'wb') as fh: - pickle.dump(self.all_tests, fh, -1) + pickle.dump(self.all_tests, fh, protocol) super(_TestResult, self).stopTestRun() def startTest(self, test):