~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to test.py

  • Committer: Aaron Bentley
  • Date: 2005-12-13 15:50:55 UTC
  • Revision ID: abentley@panoramicfeedback.com-20051213155055-afd340589db2e303
Added stand-alone tester

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python2.4
 
2
USAGE = """Just run test.py.  Any supplied arguments are treated as PYTHONPATH
 
3
prefixes."""
 
4
import sys
 
5
import os.path
 
6
import unittest
 
7
path_prefix = []
 
8
if len(sys.argv) > 1:
 
9
    if sys.argv[1] in ("-h", "--help", ""):
 
10
        print USAGE
 
11
        sys.exit(0)
 
12
    path_prefix = sys.argv[1:]
 
13
path_prefix.append(os.path.join(os.path.dirname(__file__), ".."))
 
14
sys.path = [os.path.realpath(p) for p in path_prefix] + sys.path
 
15
try:
 
16
    import bzrtools
 
17
except ImportError, e:
 
18
    if len(sys.argv) == 1 and "bzrlib" in str(e):
 
19
        print "You can spcify the path to bzrlib as the first argument"
 
20
    raise
 
21
suite = bzrtools.test_suite()
 
22
runner = unittest.TextTestRunner(verbosity=0)
 
23
result = runner.run(suite)
 
24
sys.exit({True: 0, False: 3}[result.wasSuccessful()])