Writing tornado.testing.test as simple python script (and pass command line options to the testee).
I wanted to execute tornado.testing unit test with command line options(tornado.options).
Something like
However I found this is impossible, because runtests tries to process options by itself. Then I tried to do this
by putting following code at the end of the test script(test.py in this case).
* tornado.options.parse_command_line() is called at the top of the testee's program.
This didn't work because of "AttributeError: 'module' object has no attribute 'all'" error.
So, I avoided this problem by adding "all()" function to the test.py like this, and it finally works.
Something like
python3 -m tornado.test.runtests test.py --port=8080
However I found this is impossible, because runtests tries to process options by itself. Then I tried to do this
python3 test.py --port=8080
by putting following code at the end of the test script(test.py in this case).
if __name__ == "__main__":
tornado.testing.main()
* tornado.options.parse_command_line() is called at the top of the testee's program.
This didn't work because of "AttributeError: 'module' object has no attribute 'all'" error.
So, I avoided this problem by adding "all()" function to the test.py like this, and it finally works.
def all():
import unittest
return unittest.defaultTestLoader.loadTestsFromNames([__name__])
Comments