#13636 closed (fixed)
Change fixture doctests to unit tests
Reported by: | Eric Holscher | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
These have the most amount of flushing, which will slow down real test runs. I've gone ahead and done a good amount of this, it does touch management commands to have a return_output that you can pass into call_command, so it returns instead of prints for dumpdata and such.
Attachments (4)
Change History (8)
by , 14 years ago
Attachment: | fixtures-doctests-remove.diff added |
---|
by , 14 years ago
Attachment: | nicer-migration-patch.diff added |
---|
by , 14 years ago
Attachment: | migrate-doctests-to-unittests.diff added |
---|
Updated to pass around streams for stdout and stderr
comment:1 by , 14 years ago
This is a basic patch that makes the tests pass. I'm not totally sold on the changes to the management commands -- feels like that should be using the new logging infrastructure. It should probably have a little bit of a wrapper that we can swap out the explicit stdout calls to logging.
This should probably also be 2 tickets -- but they are interconnected via a little yak shaving :)
comment:2 by , 14 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
There is one test failure for this patch under MySQL:
====================================================================== FAIL: test_format_discovery (modeltests.fixtures.tests.FixtureTransactionTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/rkm/projects/django/hg/tests/modeltests/fixtures/tests.py", line 262, in test_format_discovery '<Article: Python program becomes self aware>' File "/Users/rkm/projects/django/live/django/test/testcases.py", line 470, in assertQuerysetEqual return self.assertEqual(map(transform, qs), values) AssertionError: ['<Article: XML identified as leading cause of cancer>', '<Article: Time to reform copyright>', '<Article: Poker on TV is great!>', '<Article: Python program becomes self aware>'] != ['<Article: Time to reform copyright>', '<Article: Poker has no place on ESPN>', '<Article: Python program becomes self aware>']
The test in question was commented out under MySQL under the doctests; it's not immediately clear to me whether this is a test that should still be commented out, or whether the move to TransactionTestCase should overcome that problem and we've just revealed a previously unknown problem.
Also - given that this test introduces the stdout/stderr arguments, it would make sense to port the multiple-databases fixture loading test that currently does some jiggery-pokery to work around stdout handling.
by , 14 years ago
Attachment: | 13636-r13318.diff added |
---|
Updated fix, mostly formatting changes (this time with the missing file)
comment:3 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
A slightly updated patch.