I have a test file that contains tests taking quite a lot of time (they send calculations to a cluster and wait for the result). All of these are in specific TestCase class.
Since they take time and furthermore are not likely to break, I'd want to be able to choose whether this subset of tests does or doesn't run (the best way would be with a command-line argument, ie "./tests.py --offline
" or something like that), so I could run most of the tests often and quickly and the whole set once in a while, when I have time.
For now, I just use unittest.main()
to start the tests.
Thanks.
To run only a single specific test you can use:
$ python -m unittest test_module.TestClass.test_method
More information here