~vila/u1-test-utils/setup-vm

« back to all changes in this revision

Viewing changes to setup_vm/selftest.py

  • Committer: Vincent Ladeuil
  • Date: 2013-04-12 07:52:06 UTC
  • mfrom: (0.1.144 trunk)
  • Revision ID: vila+qa@canonical.com-20130412075206-g8lb0tob08zf3h6j
Provide a setup_vm utility to provision vms targeted at local tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
import sys
 
4
 
 
5
import testtools.run
 
6
import unittest
 
7
 
 
8
 
 
9
class TestProgram(testtools.run.TestProgram):
 
10
 
 
11
    def __init__(self, module, argv, stdout=None, testRunner=None, exit=True):
 
12
        if testRunner is None:
 
13
            testRunner = unittest.TextTestRunner
 
14
        super(TestProgram, self).__init__(module, argv=argv, stdout=stdout,
 
15
                                          testRunner=testRunner, exit=exit)
 
16
 
 
17
 
 
18
# We discover tests under './tests', the python 'load_test' protocol can be
 
19
# used in test modules for more fancy stuff.
 
20
discover_args = ['discover',
 
21
                 '--start-directory', './tests',
 
22
                 '--top-level-directory', '.',
 
23
                 ]
 
24
TestProgram(__name__, argv=[sys.argv[0]] + discover_args + sys.argv[1:])