diff --git a/xmlrunner/extra/djangotestrunner.py b/xmlrunner/extra/djangotestrunner.py index 3882a6a..c667092 100644 --- a/xmlrunner/extra/djangotestrunner.py +++ b/xmlrunner/extra/djangotestrunner.py @@ -9,12 +9,12 @@ in a Django project, please read the Django docs website. """ from django.conf import settings -from django.test.simple import DjangoTestSuiteRunner +from django.test.runner import DiscoverRunner from django.test.utils import setup_test_environment, teardown_test_environment import xmlrunner -class XMLTestRunner(DjangoTestSuiteRunner): +class XMLTestRunner(DiscoverRunner): def run_tests(self, test_labels, extra_tests=None, **kwargs): """ Run the unit tests for all the test labels in the provided list. diff --git a/xmlrunner/xmlrunner.py b/xmlrunner/xmlrunner.py index 88560ae..6e2602a 100644 --- a/xmlrunner/xmlrunner.py +++ b/xmlrunner/xmlrunner.py @@ -47,15 +47,15 @@ def __getattr__(self, attr): return getattr(self._captured, attr) -#def testcase_name(test_method): -# testcase = type(test_method) -# -# # Ignore module name if it is '__main__' -# module = testcase.__module__ + '.' -# if module == '__main__.': -# module = '' -# result = module + testcase.__name__ -# return result +def testcase_name(test_method): + testcase = type(test_method) + + # Ignore module name if it is '__main__' + module = testcase.__module__ + '.' + if module == '__main__.': + module = '' + result = module + testcase.__name__ + return result class _TestInfo(object):