~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2008-08-25 21:50:11 UTC
  • mfrom: (0.11.3 tools)
  • mto: This revision was merged to the branch mainline in revision 3659.
  • Revision ID: john@arbash-meinel.com-20080825215011-de9esmzgkue3e522
Merge in Lukáš's helper scripts.
Update the packaging documents to describe how to do the releases
using bzr-builddeb to package all distro platforms
simultaneously.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007 Canonical Ltd
 
1
# Copyright (C) 2007, 2008 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
 
19
22
import bzrlib
20
23
from bzrlib import osutils, trace
21
24
from bzrlib.tests import (
31
34
    def test_version(self):
32
35
        out = self.run_bzr("version")[0]
33
36
        self.assertTrue(len(out) > 0)
34
 
        self.assertEquals(1, out.count(bzrlib.__version__))
 
37
        self.assertEqualDiff(out.splitlines()[0],
 
38
            "Bazaar (bzr) %s" % bzrlib.__version__)
35
39
        self.assertContainsRe(out, r"(?m)^  Python interpreter:")
36
40
        self.assertContainsRe(out, r"(?m)^  Python standard library:")
37
41
        self.assertContainsRe(out, r"(?m)^  bzrlib:")
38
42
        self.assertContainsRe(out, r"(?m)^  Bazaar configuration:")
39
 
        self.assertContainsRe(out, r'(?m)^  Bazaar log file:.*bzr\.log')
 
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')
40
48
 
41
49
 
42
50
class TestVersionUnicodeOutput(TestCaseInTempDir):
74
82
        out = self.run_bzr("version")[0]
75
83
        self.assertTrue(len(out) > 0)
76
84
        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)