Opened 5 years ago
Closed 5 years ago
#31513 closed New feature (wontfix)
Store failed tests in files.
Reported by: | thenewguy | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | 3.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
It would be helpful when some (maybe all?) tests failed their assert methods wrote the relevant data to a file unique to the call.
For example, something like this:
====================================================================== FAIL: test_admin_index (integration.tests.test_known_url_response.KnownUrlResponseTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/vagrant/integration/tests/test_known_url_response.py", line 24, in test_admin_index self.assertContains(response, 'Welcome, Fanny') File "/home/vagrant/.tox/py36/lib/python3.6/site-packages/django/test/testcases.py", line 454, in assertContains self.assertTrue(real_count != 0, msg_prefix + "Couldn't find %s in response" % text_repr) AssertionError: False is not true : Couldn't find 'Welcome, Fanny' in response
It is helpful to know that the test failed, but it isn't easy to fix the test because the response html isn't available. Since it is too much to display in the console, it would be helpful if the assertContains() method logged the response content and failure message to a file and then reported the file path in the error message. Something like... for more details view this file: /path/to/failed-test-uuid.log
Then it would be easy to fix without requiring any adjustments to the test output and running the test suite again.
Change History (1)
comment:1 by , 5 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Summary: | Store failed test info in file → Store failed tests in files. |
Django is delegating to Python's testing output here. IMO we shouldn't implement our own test output or redirect failed tests to files. There are a number of third-party testing tools that offer other outputs, e.g.
pytest
. It's not worth to spend our time doing something similar. Feel free to start a thread on the DevelopersMailingList if you don't agree.