In our team, we define most test cases like this:
One \"framework\" class ourtcfw.py
:
import unittest
class OurTcFw(unittest.TestCase):
If you check out the help of the unittest module it tells you about several combinations that allow you to run test case classes from a module and test methods from a test case class.
python3 -m unittest -h
[...]
Examples:
python3 -m unittest test_module - run tests from test_module
python3 -m unittest module.TestClass - run tests from module.TestClass
python3 -m unittest module.Class.test_method - run specified test method
It does not require you to define a unittest.main()
as the default behaviour of your module.