File: test.py

package info (click to toggle)
synopsis 0.8.0-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 10,112 kB
  • ctags: 12,996
  • sloc: cpp: 34,254; ansic: 33,620; python: 10,975; sh: 7,261; xml: 6,369; makefile: 773; asm: 445
file content (49 lines) | stat: -rw-r--r-- 1,480 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#
# Copyright (C) 2004 Stefan Seefeld
# All rights reserved.
# Licensed to the public under the terms of the GNU LGPL (>= 2),
# see the file COPYING for details.
#

import os, sys, string

from distutils.core import setup
from distutils.command.build_ext import build_ext
from distutils.util import get_platform
from distutils.dir_util import mkpath
from distutils.spawn import spawn, find_executable
from shutil import *

class test(build_ext):
    """derive from build since we use almost all the same options"""

    description = "run unit test"

    user_options = build_ext.user_options[:] + [
        ('suite=', 's', "the id of a test suite to run."),
        ('interactive', None, "run the web iterface to the testing engine.")]

    boolean_options = build_ext.boolean_options[:] + ['interactive']

    def initialize_options (self):
        build_ext.initialize_options(self)
        self.suite = ''
        self.interactive = False

    def finalize_options (self):
        build_ext.finalize_options(self)

    def run(self):

        cwd = os.getcwd()
        os.environ['QMTEST_CLASS_PATH'] = os.path.join(cwd, 'tests', 'QMTest')
        test_dir = os.path.join(self.build_temp, 'tests')
        os.chdir(test_dir)

        command = "qmtest "
        command += self.interactive and "gui " or "run "
        command += self.suite
                
        self.announce(command)
        spawn(['sh', '-c', command], self.verbose, self.dry_run)
        os.chdir(cwd)