문제

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