Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#14986 closed (wontfix)

TestCase: increase verbosity for TestCase.fixtures usage

Reported by: carsten Owned by: nobody
Component: Testing framework Version: 1.2
Severity: Keywords: fixtures
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


django.test.TestCase should ouput its usage of the fixtures attr: what fixtures got installed for the currently running testcase? How many objects did they install?
TestCase currently wont even inform the user of installed fixtures even when --verbosity=2 is being used.

I'm pretty new to testing and was spending several hours(!) until I finally realised that my fixtures got imported just fine all the time by querying the imported models ; )

As a new TestCase user, the verbosity of syncdb when running the test:

Installing json fixture 'initial_data' from ..

just made me think that there was a problem with my testing fixtures. IMO, this should be output in a consistent way.

Change History (3)

comment:1 Changed 7 years ago by Russell Keith-Magee

Resolution: wontfix
Status: newclosed

This has been proposed before; see #12682, #7134, #4371. I'm sympathetic to the underlying problem, but it isn't a simple as 'just bump the verbosity'.

Firstly, there is the problem is determining when the debug message will be printed (and how often it will be printed). Fixtures are loaded at the start of every test method; the volume of "fixture loaded" messages would very rapidly swamp the useful information about the test run.

There is also an implementation issue of how to discover an appropriate level of verbosity; an individual test case doesn't have exposure to the verbosity at which it is being run.

Closing wontfix because there isn't a clear action to implement. If anyone cares to make a practical suggestion -- including a patch -- feel free to reopen.

comment:2 Changed 7 years ago by darius.damalakas

I just stumbled upon the same issue today. I debugged deep into Django internals until i understood how fixtures are loaded by testing system. What i realised is that my fixtures where loaded, but as the original author said, it did not print the output to console.

This is pretty confusing for newcomers (bingo, that's me), especially if you fall into the scenario, where you deliberately create several fixtures in the hope of that some will be loaded. And then you would see "Multiple fixtures ..." warning, but if you leave only single fixture, no messages would be printed at all, which had me to scratch head as to why Django sees my fixture, but does not install.

So to sum up, it is an important issue.

As for actual resolution:
Everything boils to this line: line 589
verbosity is explicitly beeing passed as zero.

I do not know the exact solution for problems pointed by russellm. At the moment i will just change manually verbosity from 0 to 1, which will help me learn Django. Hope this info is useful.

comment:3 Changed 7 years ago by Darius Damalakas <darius.damalakas@…>

Note: See TracTickets for help on using tickets.
Back to Top