From 2b82a8818005755920e6978c5ac3055731e43997 Mon Sep 17 00:00:00 2001 From: Jordan Adler Date: Mon, 8 Jul 2019 16:50:37 -0700 Subject: [PATCH 1/5] Remove flakiness in test_chained_exception --- tests/test_future/test_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_future/test_utils.py b/tests/test_future/test_utils.py index 30eac7a6..314d7698 100644 --- a/tests/test_future/test_utils.py +++ b/tests/test_future/test_utils.py @@ -368,7 +368,8 @@ def test_chained_exceptions_stacktrace(self): except ValueError as val_err: raise_from(CustomException('ERROR'), val_err) except Exception as err: - self.assertEqual(expected.splitlines(), traceback.format_exc().splitlines()) + ret = re.sub(r'"[^"]*tests/test_future', '"/opt/python-future/tests/test_future', traceback.format_exc()) + self.assertEqual(expected.splitlines(), ret.splitlines()) else: self.fail('No exception raised') From f7c7ebd8dc7db9580927de6644271c784d204b0e Mon Sep 17 00:00:00 2001 From: Jordan Adler Date: Mon, 8 Jul 2019 16:54:09 -0700 Subject: [PATCH 2/5] iter --- tests/test_future/test_utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_future/test_utils.py b/tests/test_future/test_utils.py index 314d7698..afe14041 100644 --- a/tests/test_future/test_utils.py +++ b/tests/test_future/test_utils.py @@ -349,15 +349,15 @@ def test_single_exception_stacktrace(self): if PY2: def test_chained_exceptions_stacktrace(self): expected = '''Traceback (most recent call last): - File "/opt/python-future/tests/test_future/test_utils.py", line 354, in test_chained_exceptions_stacktrace + File "/opt/python-future/tests/test_future/test_utils.py", line 1, in test_chained_exceptions_stacktrace raise_from(CustomException('ERROR'), val_err) - File "/opt/python-future/src/future/utils/__init__.py", line 456, in raise_from + File "/opt/python-future/src/future/utils/__init__.py", line 1, in raise_from raise e CustomException: ERROR The above exception was the direct cause of the following exception: - File "/opt/python-future/tests/test_future/test_utils.py", line 352, in test_chained_exceptions_stacktrace + File "/opt/python-future/tests/test_future/test_utils.py", line 1, in test_chained_exceptions_stacktrace raise ValueError('Wooops') ValueError: Wooops ''' @@ -369,6 +369,7 @@ def test_chained_exceptions_stacktrace(self): raise_from(CustomException('ERROR'), val_err) except Exception as err: ret = re.sub(r'"[^"]*tests/test_future', '"/opt/python-future/tests/test_future', traceback.format_exc()) + ret = re.sub(r', line \d+,', ', line 1,', ret) self.assertEqual(expected.splitlines(), ret.splitlines()) else: self.fail('No exception raised') From a0e400767763c7fca39546514f14621e625caa4d Mon Sep 17 00:00:00 2001 From: Jordan Adler Date: Mon, 8 Jul 2019 17:00:57 -0700 Subject: [PATCH 3/5] iter --- tests/test_future/test_utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_future/test_utils.py b/tests/test_future/test_utils.py index afe14041..95ef4d67 100644 --- a/tests/test_future/test_utils.py +++ b/tests/test_future/test_utils.py @@ -369,6 +369,7 @@ def test_chained_exceptions_stacktrace(self): raise_from(CustomException('ERROR'), val_err) except Exception as err: ret = re.sub(r'"[^"]*tests/test_future', '"/opt/python-future/tests/test_future', traceback.format_exc()) + ret = re.sub(r'"[^"]*src/future', '"/opt/python-future/src/future', traceback.format_exc()) ret = re.sub(r', line \d+,', ', line 1,', ret) self.assertEqual(expected.splitlines(), ret.splitlines()) else: From 95550463a8fcb699096d9864e97a5e4d3cc43549 Mon Sep 17 00:00:00 2001 From: Jordan Adler Date: Mon, 8 Jul 2019 17:04:24 -0700 Subject: [PATCH 4/5] bugfix --- tests/test_future/test_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_future/test_utils.py b/tests/test_future/test_utils.py index 95ef4d67..73de3076 100644 --- a/tests/test_future/test_utils.py +++ b/tests/test_future/test_utils.py @@ -369,7 +369,7 @@ def test_chained_exceptions_stacktrace(self): raise_from(CustomException('ERROR'), val_err) except Exception as err: ret = re.sub(r'"[^"]*tests/test_future', '"/opt/python-future/tests/test_future', traceback.format_exc()) - ret = re.sub(r'"[^"]*src/future', '"/opt/python-future/src/future', traceback.format_exc()) + ret = re.sub(r'"[^"]*src/future', '"/opt/python-future/src/future', ret) ret = re.sub(r', line \d+,', ', line 1,', ret) self.assertEqual(expected.splitlines(), ret.splitlines()) else: From 015e837df95580e164fb8595236aea382b279c37 Mon Sep 17 00:00:00 2001 From: Jordan Adler Date: Mon, 8 Jul 2019 17:10:21 -0700 Subject: [PATCH 5/5] bugfix --- tests/test_future/test_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_future/test_utils.py b/tests/test_future/test_utils.py index 73de3076..9034400f 100644 --- a/tests/test_future/test_utils.py +++ b/tests/test_future/test_utils.py @@ -369,7 +369,7 @@ def test_chained_exceptions_stacktrace(self): raise_from(CustomException('ERROR'), val_err) except Exception as err: ret = re.sub(r'"[^"]*tests/test_future', '"/opt/python-future/tests/test_future', traceback.format_exc()) - ret = re.sub(r'"[^"]*src/future', '"/opt/python-future/src/future', ret) + ret = re.sub(r'"[^"]*future/utils/__init__.py', '"/opt/python-future/src/future/utils/__init__.py', ret) ret = re.sub(r', line \d+,', ', line 1,', ret) self.assertEqual(expected.splitlines(), ret.splitlines()) else: