Allow to run all test cases in a folder that is on the PYTHONPATH.
The function tobiko.run.run_tests will perform below operations:
- recursively look for all python modules matching 'test_*.py'
in a given directory
- create a TestSuite out of all subclasses of unittest.TestCase
found on discovered modules
- run the test suite, recording the result in on a TestResult class
instance
- eventually (if check parameter is not False as by default) it also
forward test errors and failures to the test case that called it
Example of use:
import unittest
from tobiko import run
class MyFaultsTest(unittest.TestCase):
def run(result):
result_before = run_tests('tobiko/tests/sanity')
try:
super().run(result)
finally:
result_after = run_tests('tobiko/tests/sanity')
# ... eventually compare errors and failures between
# result_before and result_after
def test_some_failure(self):
...
Change-Id: I22b14a40ed6b02d62e486e138f6d0172bbc9f92c