I have a very large TestSuite that I run with TextTestRunner from the python unittest framework. Unfortunately I have no idea how many tests are already done while the test are running.
Basically I'd like to convert this output:
test_choice (__main__.TestSequenceFunctions) ... ok
test_sample (__main__.TestSequenceFunctions) ... ok
test_shuffle (__main__.TestSequenceFunctions) ... ok
----------------------------------------------------------------------
Ran 3 tests in 0.110s
OK
to
[1/3] test_choice (__main__.TestSequenceFunctions) ... ok
[2/3] test_sample (__main__.TestSequenceFunctions) ... ok
[3/3] test_shuffle (__main__.TestSequenceFunctions) ... ok
----------------------------------------------------------------------
Ran 3 tests in 0.110s
OK
Do I have to subclass TextTestRunner to achieve this and if yes, how?
Note: I'm aware of nose and the available plugins, but it does not quite fit in my application and I'd like to avoid the dependency.
EDIT Why I'd like to avoid nose:
My Application is basically an additional framework for the tests. It select the correct test cases, provides library functions for them and executes the tests multiple times for long term testing. (the tests run against an external machine)
So here is how I run my tests right now:
# do all sort of preperations
[...]
test_suite = TestSuite()
repeatitions = 100
tests = get_tests()
for i in range(0, repeatitions):
test_suite.addTests(tests)
TextTestRunner(verbosity=2).run(test_suite)
My problem with nose is, that it is designed to discover the tests from the filesystem and I was unable to find a clear documentation how to run it on a particular TestSuite directly from python.