~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to test.py

  • Committer: Aaron Bentley
  • Date: 2005-06-08 15:31:24 UTC
  • Revision ID: abentley@panoramicfeedback.com-20050608153124-416aa7abcf217ccc
Ensured all tests pass

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
 
import tempfile
8
 
import shutil
9
 
path_prefix = []
10
 
if len(sys.argv) > 1:
11
 
    if sys.argv[1] in ("-h", "--help", ""):
12
 
        print USAGE
13
 
        sys.exit(0)
14
 
    path_prefix = sys.argv[1:]
15
 
path_prefix.append(os.path.join(os.path.dirname(__file__), ".."))
16
 
sys.path = [os.path.realpath(p) for p in path_prefix] + sys.path
17
 
try:
18
 
    import bzrtools
19
 
except ImportError, e:
20
 
    if len(sys.argv) == 1 and "bzrlib" in str(e):
21
 
        print "You can spcify the path to bzrlib as the first argument"
22
 
    raise
23
 
suite = bzrtools.test_suite()
24
 
runner = unittest.TextTestRunner(verbosity=0)
25
 
tempdir = tempfile.mkdtemp()
26
 
 
27
 
try:
28
 
    os.chdir(tempdir)
29
 
    result = runner.run(suite)
30
 
finally:
31
 
    shutil.rmtree(tempdir)
32
 
 
33
 
sys.exit({True: 0, False: 3}[result.wasSuccessful()])