~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: 2007-12-20 16:16:34 UTC
  • mfrom: (3123.5.18 hardlinks)
  • Revision ID: pqm@pqm.ubuntu.com-20071220161634-2kcjb650o21ydko4
Accelerate build_tree using similar workingtrees (abentley)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007, 2008 Canonical Ltd
 
1
# Copyright (C) 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
16
16
 
17
17
"""Black-box tests for bzr version."""
18
18
 
19
 
import os
20
 
import sys
21
 
 
22
19
import bzrlib
23
20
from bzrlib import osutils, trace
24
21
from bzrlib.tests import (
34
31
    def test_version(self):
35
32
        out = self.run_bzr("version")[0]
36
33
        self.assertTrue(len(out) > 0)
37
 
        self.assertEqualDiff(out.splitlines()[0],
38
 
            "Bazaar (bzr) %s" % bzrlib.__version__)
 
34
        self.assertEquals(1, out.count(bzrlib.__version__))
39
35
        self.assertContainsRe(out, r"(?m)^  Python interpreter:")
40
36
        self.assertContainsRe(out, r"(?m)^  Python standard library:")
41
37
        self.assertContainsRe(out, r"(?m)^  bzrlib:")
42
38
        self.assertContainsRe(out, r"(?m)^  Bazaar configuration:")
43
 
        self.assertContainsRe(out, r'(?m)^  Bazaar log file:.*\.bzr\.log')
44
 
 
45
 
    def test_version_short(self):
46
 
        out = self.run_bzr(["version", "--short"])[0]
47
 
        self.assertEqualDiff(out, bzrlib.version_string + '\n')
 
39
        self.assertContainsRe(out, r'(?m)^  Bazaar log file:.*bzr\.log')
48
40
 
49
41
 
50
42
class TestVersionUnicodeOutput(TestCaseInTempDir):
82
74
        out = self.run_bzr("version")[0]
83
75
        self.assertTrue(len(out) > 0)
84
76
        self.assertContainsRe(out, r"(?m)^  Bazaar configuration: " + str_val)
85
 
 
86
 
 
87
 
class TestVersionBzrLogLocation(TestCaseInTempDir):
88
 
 
89
 
    def test_simple(self):
90
 
        bzr_log = 'my.bzr.log'
91
 
        osutils.set_or_unset_env('BZR_LOG', bzr_log)
92
 
        default_log = os.path.join(os.environ['BZR_HOME'], '.bzr.log')
93
 
        self.failIfExists([default_log, bzr_log])
94
 
        out = self.run_bzr_subprocess('version')[0]
95
 
        self.assertTrue(len(out) > 0)
96
 
        self.assertContainsRe(out, r"(?m)^  Bazaar log file: " + bzr_log)
97
 
        self.failIfExists(default_log)
98
 
        self.failUnlessExists(bzr_log)
99
 
 
100
 
    def test_dev_null(self):
101
 
        if sys.platform == 'win32':
102
 
            bzr_log = 'NUL'
103
 
        else:
104
 
            bzr_log = '/dev/null'
105
 
        osutils.set_or_unset_env('BZR_LOG', bzr_log)
106
 
        default_log = os.path.join(os.environ['BZR_HOME'], '.bzr.log')
107
 
        self.failIfExists(default_log)
108
 
        out = self.run_bzr_subprocess('version')[0]
109
 
        self.assertTrue(len(out) > 0)
110
 
        self.assertContainsRe(out, r"(?m)^  Bazaar log file: " + bzr_log)
111
 
        self.failIfExists(default_log)