質問

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.

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top