Skip to content

Commit 6355c79

Browse files
authored
Merge pull request #483 from jmadler/master
Remove flakiness in test_single_exception
2 parents 79477c2 + d711695 commit 6355c79

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/test_future/test_utils.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"""
55

66
from __future__ import absolute_import, unicode_literals, print_function
7-
import sys, traceback
7+
import re, sys, traceback
88
from future.builtins import *
99
from future.utils import (old_div, istext, isbytes, native, PY2, PY3,
1010
native_str, raise_, as_native_str, ensure_new_type,
@@ -335,12 +335,14 @@ def test_single_exception_stacktrace(self):
335335
if PY2:
336336
expected += 'CustomException: ERROR\n'
337337
else:
338-
expected += 'tests.test_future.test_utils.CustomException: ERROR\n'
338+
expected += 'test_future.test_utils.CustomException: ERROR\n'
339339

340340
try:
341341
raise CustomException('ERROR')
342342
except:
343-
self.assertEqual(expected, traceback.format_exc())
343+
ret = re.sub(r'"[^"]*tests/test_future', '"/opt/python-future/tests/test_future', traceback.format_exc())
344+
ret = re.sub(r', line \d+,', ', line 328,', ret)
345+
self.assertEqual(expected, ret)
344346
else:
345347
self.fail('No exception raised')
346348

0 commit comments

Comments
 (0)