There are several ways to achieve that: one is run nose with xunit plugin with --collect-only
and parse the resulting junit xml file. Alternatively, you can add a basic plugin that captures names of the tests, something like this:
import sys
from unittest import TestCase
import nose
from nose.tools import set_trace
class CollectPlugin(object):
enabled = True
name = "test-collector"
score = 100
def options(self, parser, env):
pass
def configure(self, options, conf):
self.tests = []
def startTest(self, test):
self.tests.append(test)
class MyTestCase(TestCase):
def test_long_integration(self):
pass
def test_end_to_end_something(self):
pass
if __name__ == '__main__':
# this code will run just this file, change module_name to something
# else to make it work for folder structure, etc
module_name = sys.modules[__name__].__file__
plugin = CollectPlugin()
result = nose.run(argv=[sys.argv[0],
module_name,
'--collect-only',
],
addplugins=[plugin],)
for test in plugin.tests:
print test.id()
Your test information is all captured in plugin.test
structure.