~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to test.py

  • Committer: Michael Ellerman
  • Date: 2005-11-29 07:12:26 UTC
  • mto: (0.3.1 shelf-dev) (325.1.2 bzrtools)
  • mto: This revision was merged to the branch mainline in revision 334.
  • Revision ID: michael@ellerman.id.au-20051129071226-a04b3f827880025d
Unshelve --pick was broken, because we deleted the whole patch, even when only
part of it was unshelved. So now if we unshelve part of a patch, the patch is
replaced with a new patch that has just the unshelved parts. That's a long way
of saying it does what you'd expect.

Implementing this required changing HunkSelector to return both the selected,
and unselected hunks (ie. patches to shelve, and patches to keep).

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()])