~ubuntu-branches/ubuntu/precise/gst0.10-python/precise

« back to all changes in this revision

Viewing changes to testsuite/runtests.py

  • Committer: Bazaar Package Importer
  • Author(s): Loic Minier
  • Date: 2006-06-25 19:37:45 UTC
  • Revision ID: james.westby@ubuntu.com-20060625193745-9yeg0wq56r24n57x
Tags: upstream-0.10.4
ImportĀ upstreamĀ versionĀ 0.10.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
# -*- Mode: Python -*-
 
3
# vi:si:et:sw=4:sts=4:ts=4
 
4
#
 
5
# gst-python - Python bindings for GStreamer
 
6
# Copyright (C) 2002 David I. Lehn
 
7
# Copyright (C) 2004 Johan Dahlin
 
8
# Copyright (C) 2005 Edward Hervey
 
9
#
 
10
# This library is free software; you can redistribute it and/or
 
11
# modify it under the terms of the GNU Lesser General Public
 
12
# License as published by the Free Software Foundation; either
 
13
# version 2.1 of the License, or (at your option) any later version.
 
14
#
 
15
# This library is distributed in the hope that it will be useful,
 
16
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
18
# Lesser General Public License for more details.
 
19
#
 
20
# You should have received a copy of the GNU Lesser General Public
 
21
# License along with this library; if not, write to the Free Software
 
22
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
23
 
 
24
import glob
 
25
import os
 
26
import sys
 
27
import unittest
 
28
 
 
29
SKIP_FILES = ['common', 'runtests']
 
30
 
 
31
def gettestnames(which):
 
32
    if not which:
 
33
        dir = os.path.split(os.path.abspath(__file__))[0]
 
34
        which = [os.path.basename(p) for p in glob.glob('%s/*.py' % dir)]
 
35
    
 
36
    names = map(lambda x: x[:-3], which)
 
37
    for f in SKIP_FILES:
 
38
        if f in names:
 
39
            names.remove(f)
 
40
    return names
 
41
        
 
42
suite = unittest.TestSuite()
 
43
loader = unittest.TestLoader()
 
44
 
 
45
for name in gettestnames(sys.argv[1:]):
 
46
    suite.addTest(loader.loadTestsFromName(name))
 
47
    
 
48
descriptions = 1
 
49
verbosity = 1
 
50
if os.environ.has_key('VERBOSE'):
 
51
    descriptions = 2
 
52
    verbosity = 2
 
53
 
 
54
testRunner = unittest.TextTestRunner(descriptions=descriptions,
 
55
    verbosity=verbosity)
 
56
result = testRunner.run(suite)
 
57
if result.failures or result.errors:
 
58
    sys.exit(1)