Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 49 lines (40 sloc) 1.444 kb
99a012ce »
2009-12-28 Initial commit
1 #!/usr/bin/env python
bdae35c7 »
2010-12-26 upgrade to venus http://github.com/rubys/venus
2 import glob, unittest, os, sys
3
4 # python 2.2 accomodations
5 try:
6 from trace import fullmodname
7 except:
8 def fullmodname(path):
9 return os.path.splitext(path)[0].replace(os.sep, '.')
10
11 # more python 2.2 accomodations
12 if not hasattr(unittest.TestCase, 'assertTrue'):
13 unittest.TestCase.assertTrue = unittest.TestCase.assert_
14 if not hasattr(unittest.TestCase, 'assertFalse'):
15 unittest.TestCase.assertFalse = unittest.TestCase.failIf
16
17 # try to start in a consistent, predictable location
18 if sys.path[0]: os.chdir(sys.path[0])
19 sys.path[0] = os.getcwd()
20
21 # determine verbosity
22 verbosity = 1
23 for arg,value in (('-q',0),('--quiet',0),('-v',2),('--verbose',2)):
24 if arg in sys.argv:
25 verbosity = value
26 sys.argv.remove(arg)
99a012ce »
2009-12-28 Initial commit
27
28 # find all of the planet test modules
bdae35c7 »
2010-12-26 upgrade to venus http://github.com/rubys/venus
29 modules = []
30 for pattern in sys.argv[1:] or ['test_*.py']:
31 modules += map(fullmodname, glob.glob(os.path.join('tests', pattern)))
32
33 # enable logging
34 import planet
35 if verbosity == 0: planet.getLogger("FATAL",None)
36 if verbosity == 1: planet.getLogger("WARNING",None)
37 if verbosity == 2: planet.getLogger("DEBUG",None)
99a012ce »
2009-12-28 Initial commit
38
39 # load all of the tests into a suite
bdae35c7 »
2010-12-26 upgrade to venus http://github.com/rubys/venus
40 try:
41 suite = unittest.TestLoader().loadTestsFromNames(modules)
42 except Exception, exception:
43 # attempt to produce a more specific message
44 for module in modules: __import__(module)
45 raise
99a012ce »
2009-12-28 Initial commit
46
47 # run test suite
bdae35c7 »
2010-12-26 upgrade to venus http://github.com/rubys/venus
48 unittest.TextTestRunner(verbosity=verbosity).run(suite)
Something went wrong with that request. Please try again.