I am running a particular unit test in my library, and I would like to get more logging from it. I am running it in the following way:
python -m unittest my_module.my_submodule_test.MyTestClass.test_my_testcase
Because I'm doing this, the my_submodule_test.py
file does not run the bottom part where I set the log level like so:
if __name__ == '__main__':
logging.getLogger().setLevel(logging.DEBUG)
unittest.main()
How can I programatically set the log level so that I can get more detailed logging from my test?
Also, I'd like to be able to set the logging via a command-line argument. Is there a way to do that?