/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_logformats.py

  • Committer: Vincent Ladeuil
  • Date: 2009-05-05 12:27:06 UTC
  • mto: (4343.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4344.
  • Revision ID: v.ladeuil+lp@free.fr-20090505122706-hha5brmq94mld5cb
Some cleanups.

* bzrlib/tests/blackbox/test_logformats.py: 
Fix import, use a proper setUp method.

* bzrlib/tests/test_log.py:
(LogCatcher.__init__): Fix comment.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
import os
23
23
 
24
 
 
25
 
from bzrlib.branch import Branch
26
 
from bzrlib.tests import TestCaseInTempDir
27
 
from bzrlib.config import (ensure_config_dir_exists, config_filename)
28
 
 
29
 
 
30
 
class TestLogFormats(TestCaseInTempDir):
 
24
from bzrlib import (
 
25
    config,
 
26
    tests,
 
27
    )
 
28
 
 
29
 
 
30
class TestLogFormats(tests.TestCaseInTempDir):
 
31
 
 
32
    def setUp(self):
 
33
        super(TestLogFormats, self).setUp()
 
34
 
 
35
        conf_path = config.config_filename()
 
36
        if os.path.isfile(conf_path):
 
37
                # Something is wrong in environment,
 
38
                # we risk overwriting users config
 
39
                self.fail("%s exists" % conf_path)
 
40
 
 
41
        config.ensure_config_dir_exists()
 
42
        conf = open(conf_path,'wb')
 
43
        try:
 
44
            conf.write("""[DEFAULT]
 
45
email=Joe Foo <joe@foo.com>
 
46
log_format=line
 
47
""")
 
48
        finally:
 
49
            conf.close()
31
50
 
32
51
    def test_log_default_format(self):
33
 
        self.setup_config()
34
 
 
35
52
        self.run_bzr('init')
36
53
        open('a', 'wb').write('foo\n')
37
54
        self.run_bzr('add a')
54
71
 
55
72
        self.run_bzr('commit -m 2')
56
73
 
57
 
        # only the lines formatter is this short
58
74
        self.assertEquals(7,
59
75
            len(self.run_bzr('log --log-format short')[0].split('\n')))
60
76
 
61
77
    def test_missing_default_format(self):
62
 
        self.setup_config()
63
 
 
64
78
        os.mkdir('a')
65
79
        os.chdir('a')
66
80
        self.run_bzr('init')
87
101
        os.chdir('..')
88
102
 
89
103
    def test_missing_format_arg(self):
90
 
        self.setup_config()
91
 
 
92
104
        os.mkdir('a')
93
105
        os.chdir('a')
94
106
        self.run_bzr('init')
117
129
 
118
130
    def test_logformat_gnu_changelog(self):
119
131
        # from http://launchpad.net/bugs/29582/
120
 
        self.setup_config()
121
132
        repo_url = self.make_trivial_history()
122
133
 
123
134
        out, err = self.run_bzr(
143
154
        bb.finish_series()
144
155
        return self.get_url('repo/a')
145
156
 
146
 
    def setup_config(self):
147
 
        if os.path.isfile(config_filename()):
148
 
                # Something is wrong in environment,
149
 
                # we risk overwriting users config
150
 
                self.assert_(config_filename() + "exists, abort")
151
 
 
152
 
        ensure_config_dir_exists()
153
 
        CONFIG=("[DEFAULT]\n"
154
 
                "email=Joe Foo <joe@foo.com>\n"
155
 
                "log_format=line\n")
156
 
 
157
 
        open(config_filename(),'wb').write(CONFIG)