Created
December 25, 2011 19:50
-
-
Save kipanshi/1519666 to your computer and use it in GitHub Desktop.
OrderedCITestSuiteRunner (if you use TransacionTestCase along with TestCase in Django)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import unittest | |
| from django_jenkins.runner import CITestSuiteRunner | |
| from django.test import TestCase | |
| from django.test.simple import reorder_suite | |
| from django_jenkins import signals | |
| class OrderedCITestSuiteRunner(CITestSuiteRunner): | |
| """ | |
| This particular test suite runner do Django test cases ordering, | |
| putting TransactionTestCase to the end. | |
| USAGE: | |
| In ``settings.py``: | |
| JENKINS_TEST_RUNNER = 'YOUR_APP.testlib.OrderedCITestSuiteRunner' | |
| """ | |
| def build_suite(self, test_labels, **kwargs): | |
| suite = unittest.TestSuite() | |
| signals.build_suite.send(sender=self, suite=suite) | |
| return reorder_suite(suite, (TestCase,)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment