/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
0.200.18 by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc.
1
# Copyright (C) 2006, 2007 Canonical Ltd
2
#
0.201.1 by Jelmer Vernooij
Add very small initial testsuite.
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
0.200.18 by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc.
7
#
0.201.1 by Jelmer Vernooij
Add very small initial testsuite.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
0.200.18 by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc.
12
#
0.201.1 by Jelmer Vernooij
Add very small initial testsuite.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
0.200.19 by John Arbash Meinel
More refactoring. Add some direct tests for GitModel.
17
"""The basic test suite for bzr-git."""
18
19
import subprocess
20
0.200.18 by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc.
21
from bzrlib import (
22
    tests,
23
    trace,
24
    )
25
26
TestCase = tests.TestCase
27
TestCaseInTempDir = tests.TestCaseInTempDir
28
TestCaseWithTransport = tests.TestCaseWithTransport
29
30
31
class _GitCommandFeature(tests.Feature):
32
33
    def _probe(self):
34
        try:
35
            p = subprocess.Popen(['git', '--version'], stdout=subprocess.PIPE)
36
        except IOError:
37
            return False
38
        out, err = p.communicate()
39
        trace.mutter('Using: %s', out.rstrip('\n'))
40
        return True
41
42
    def feature_name(self):
43
        return 'git'
44
45
GitCommandFeature = _GitCommandFeature()
46
47
0.200.19 by John Arbash Meinel
More refactoring. Add some direct tests for GitModel.
48
def run_git(*args):
49
    cmd = ['git'] + list(args)
50
    p = subprocess.Popen(cmd,
51
                         stdout=subprocess.PIPE,
52
                         stderr=subprocess.PIPE)
53
    out, err = p.communicate()
54
    if p.returncode != 0:
55
        raise AssertionError('Bad return code: %d for %s:\n%s'
56
                             % (p.returncode, ' '.join(cmd), err))
57
    return out
58
59
0.201.1 by Jelmer Vernooij
Add very small initial testsuite.
60
def test_suite():
0.200.18 by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc.
61
    loader = tests.TestLoader()
62
63
    suite = tests.TestSuite()
64
65
    testmod_names = [
66
        'test_git_branch',
67
        'test_git_dir',
68
        'test_git_repository',
0.200.19 by John Arbash Meinel
More refactoring. Add some direct tests for GitModel.
69
        'test_model',
0.200.18 by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc.
70
        'test_ids',
71
        ]
72
    testmod_names = ['%s.%s' % (__name__, t) for t in testmod_names]
73
    suite.addTests(loader.loadTestsFromModuleNames(testmod_names))
0.201.1 by Jelmer Vernooij
Add very small initial testsuite.
74
75
    return suite