This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2020年11月02日 18:25 by dseomn, last changed 2022年04月11日 14:59 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| foo.py | dseomn, 2020年11月02日 18:25 | |||
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 23687 | iritkatriel, 2020年12月08日 01:47 | ||
| PR 23688 | open | iritkatriel, 2020年12月08日 01:48 | |
| Messages (3) | |||
|---|---|---|---|
| msg380244 - (view) | Author: David Mandelberg (dseomn) | Date: 2020年11月02日 18:25 | |
The traceback in the output of the attached test (see below) doesn't include line 5, which is where the original exception is raised. I think this is because https://github.com/python/cpython/blob/b9ee4af4c643a323779fd7076e80b29d611f2709/Lib/unittest/result.py#L180-L186 uses the `limit` parameter to try to hide the implementation of `self.fail()` from the traceback, but `traceback.TracebackException.format()` applies the limit to the chained exception. I'm not sure if that's a bug in unittest or traceback, but from the comment in the above part of unittest, I don't think it's intentional. F ====================================================================== FAIL: test_foo (__main__.FooTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "foo.py", line 12, in test_foo foo() ValueError: foo During handling of the above exception, another exception occurred: Traceback (most recent call last): File "foo.py", line 14, in test_foo self.fail('foo() raised ValueError') AssertionError: foo() raised ValueError ---------------------------------------------------------------------- Ran 1 test in 0.000s FAILED (failures=1) |
|||
| msg382705 - (view) | Author: Irit Katriel (iritkatriel) * (Python committer) | Date: 2020年12月08日 01:56 | |
I made a patch that replaces the limit hack by a filter on the traceback. We could stop here an just fix this, or we could create a more generic filter in the traceback module as suggested in issue31299. |
|||
| msg390489 - (view) | Author: Irit Katriel (iritkatriel) * (Python committer) | Date: 2021年04月07日 22:07 | |
I think this is the same as issue37712. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:59:37 | admin | set | github: 86413 |
| 2021年04月09日 13:31:56 | iritkatriel | set | status: open -> closed superseder: unittest swallows part of stack trace when raising AssertionError in a TestCase resolution: duplicate stage: patch review -> resolved |
| 2021年04月07日 22:07:07 | iritkatriel | set | messages: + msg390489 |
| 2020年12月08日 01:56:34 | iritkatriel | set | messages: + msg382705 |
| 2020年12月08日 01:48:58 | iritkatriel | set | pull_requests: + pull_request22556 |
| 2020年12月08日 01:47:52 | iritkatriel | set | pull_requests: + pull_request22555 |
| 2020年12月08日 01:47:35 | iritkatriel | set | pull_requests: - pull_request22552 |
| 2020年12月08日 01:46:55 | iritkatriel | set | pull_requests: + pull_request22552 |
| 2020年12月08日 01:46:10 | iritkatriel | set | pull_requests: - pull_request22552 |
| 2020年12月08日 01:43:56 | iritkatriel | set | versions: + Python 3.10, - Python 3.8 |
| 2020年12月08日 01:36:15 | iritkatriel | set | keywords:
+ patch nosy: + iritkatriel pull_requests: + pull_request22552 stage: patch review |
| 2020年11月02日 18:25:59 | dseomn | create | |