Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppress factory_boy captured logging information?

Is there any way to suppress (i.e. hide) the captured logging information block factory boy generates when a test fails or generates an error? I'm talking about this:

SomeError: you encountered an error
----------- >> begin captured loggin << -----------
... DEBUG information
----------- >> end captured loggin << -------------

---------------------------------------------------
Ran 1 test...

Often times, this information isn't relevant or necessary to solve the problem and it's just a lot of stuff I have to scroll up past to see what caused the error.

Thanks.

like image 934
Jim Avatar asked Oct 03 '13 15:10

Jim


1 Answers

You can change the factory_boy logging level with:

import logging
logging.getLogger("factory").setLevel(logging.WARN)

Replacing WARN with whatever level you want. I don't know where to put this in a Django environment, but you can put this in your test file or some global initializer.

This should suppress any logging except actual factory_boy errors & warnings.

Weird default, since factory_boy debugging is rarely helpful and is incredibly verbose.

like image 132
Jim Stewart Avatar answered Nov 03 '22 20:11

Jim Stewart