~allenap/maas/ipmi-power-confusion--bug-1560830

« back to all changes in this revision

Viewing changes to src/maas/testing/runner.py

  • Committer: Gavin Panella
  • Date: 2012-01-19 10:37:57 UTC
  • mfrom: (16.3.22 test-bling)
  • Revision ID: gavin.panella@canonical.com-20120119103757-surtgos6dn4krulo
[r=rvba] Adds testtools and testresources, templates for new source files, import formatting utility from Launchpad, and fixes some lint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
from subprocess import check_call
 
2
 
2
3
from django.test.simple import DjangoTestSuiteRunner
3
 
 
4
 
 
5
 
class CustomTestRunner(DjangoTestSuiteRunner):
 
4
from testresources import OptimisingTestSuite
 
5
 
 
6
 
 
7
class TestRunner(DjangoTestSuiteRunner):
6
8
    """Custom test runner; ensures that the test database cluster is up."""
7
9
 
 
10
    def build_suite(self, test_labels, extra_tests=None, **kwargs):
 
11
        suite = super(TestRunner, self).build_suite(
 
12
            test_labels, extra_tests, **kwargs)
 
13
        return OptimisingTestSuite(suite)
 
14
 
8
15
    def setup_databases(self, *args, **kwargs):
9
16
        """Fire up the db cluster, then punt to original implementation."""
10
17
        check_call(['bin/maasdb', 'start', './db/', 'disposable'])
11
 
        return super(CustomTestRunner, self).setup_databases(*args, **kwargs)
 
18
        return super(TestRunner, self).setup_databases(*args, **kwargs)