~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-02-23 12:10:51 UTC
  • mfrom: (3193.6.9 disable.bzr.log)
  • Revision ID: pqm@pqm.ubuntu.com-20080223121051-ntecw60563jadb3s
(bialix) BZR_LOG env. variable controls location of .bzr.log

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Black-box tests for bzr version."""
18
18
 
 
19
import os
 
20
import sys
 
21
 
19
22
import bzrlib
20
23
from bzrlib import osutils, trace
21
24
from bzrlib.tests import (
36
39
        self.assertContainsRe(out, r"(?m)^  Python standard library:")
37
40
        self.assertContainsRe(out, r"(?m)^  bzrlib:")
38
41
        self.assertContainsRe(out, r"(?m)^  Bazaar configuration:")
39
 
        self.assertContainsRe(out, r'(?m)^  Bazaar log file:.*bzr\.log')
 
42
        self.assertContainsRe(out, r'(?m)^  Bazaar log file:.*\.bzr\.log')
40
43
 
41
44
 
42
45
class TestVersionUnicodeOutput(TestCaseInTempDir):
74
77
        out = self.run_bzr("version")[0]
75
78
        self.assertTrue(len(out) > 0)
76
79
        self.assertContainsRe(out, r"(?m)^  Bazaar configuration: " + str_val)
 
80
 
 
81
 
 
82
class TestVersionBzrLogLocation(TestCaseInTempDir):
 
83
 
 
84
    def test_simple(self):
 
85
        bzr_log = 'my.bzr.log'
 
86
        osutils.set_or_unset_env('BZR_LOG', bzr_log)
 
87
        default_log = os.path.join(os.environ['BZR_HOME'], '.bzr.log')
 
88
        self.failIfExists([default_log, bzr_log])
 
89
        out = self.run_bzr_subprocess('version')[0]
 
90
        self.assertTrue(len(out) > 0)
 
91
        self.assertContainsRe(out, r"(?m)^  Bazaar log file: " + bzr_log)
 
92
        self.failIfExists(default_log)
 
93
        self.failUnlessExists(bzr_log)
 
94
 
 
95
    def test_dev_null(self):
 
96
        if sys.platform == 'win32':
 
97
            bzr_log = 'NUL'
 
98
        else:
 
99
            bzr_log = '/dev/null'
 
100
        osutils.set_or_unset_env('BZR_LOG', bzr_log)
 
101
        default_log = os.path.join(os.environ['BZR_HOME'], '.bzr.log')
 
102
        self.failIfExists(default_log)
 
103
        out = self.run_bzr_subprocess('version')[0]
 
104
        self.assertTrue(len(out) > 0)
 
105
        self.assertContainsRe(out, r"(?m)^  Bazaar log file: " + bzr_log)
 
106
        self.failIfExists(default_log)