Skip to content

Instantly share code, notes, and snippets.

@kipanshi
Created December 25, 2011 19:50
Show Gist options
  • Save kipanshi/1519666 to your computer and use it in GitHub Desktop.
Save kipanshi/1519666 to your computer and use it in GitHub Desktop.
OrderedCITestSuiteRunner (if you use TransacionTestCase along with TestCase in Django)
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