~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to test.py

  • Committer: Michael Ellerman
  • Date: 2005-10-19 10:20:01 UTC
  • mto: (0.3.1 shelf-dev) (325.1.2 bzrtools)
  • mto: This revision was merged to the branch mainline in revision 246.
  • Revision ID: michael@ellerman.id.au-20051019102001-e646913281320323
Add __init__.py, put cmd_shelve/unshelve in there.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
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
 
    from bzrlib.plugins import bzrtools
19
 
except ImportError, e:
20
 
    if len(sys.argv) == 1 and "bzrlib" in str(e):
21
 
        print "You can specify 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()])