~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Andrew Bennetts
  • Date: 2010-10-13 00:26:41 UTC
  • mto: This revision was merged to the branch mainline in revision 5498.
  • Revision ID: andrew.bennetts@canonical.com-20101013002641-9tlh9k89mlj1666m
Keep docs-plain working.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007, 2008, 2009, 2011 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
95
95
            raise TestSkipped('Cannot find a unicode character that works in'
96
96
                              ' encoding %s' % (osutils.get_user_encoding(),))
97
97
 
98
 
        self.overrideEnv('BZR_HOME', str_val)
 
98
        osutils.set_or_unset_env('BZR_HOME', str_val)
99
99
        self.permit_source_tree_branch_repo()
100
100
        out = self.run_bzr("version")[0]
101
101
        self.assertTrue(len(out) > 0)
106
106
 
107
107
    def test_simple(self):
108
108
        bzr_log = 'my.bzr.log'
109
 
        self.overrideEnv('BZR_LOG', bzr_log)
 
109
        osutils.set_or_unset_env('BZR_LOG', bzr_log)
110
110
        default_log = os.path.join(os.environ['BZR_HOME'], '.bzr.log')
111
 
        self.assertPathDoesNotExist([default_log, bzr_log])
 
111
        self.failIfExists([default_log, bzr_log])
112
112
        out = self.run_bzr_subprocess('version')[0]
113
113
        self.assertTrue(len(out) > 0)
114
114
        self.assertContainsRe(out, r"(?m)^  Bazaar log file: " + bzr_log)
115
 
        self.assertPathDoesNotExist(default_log)
116
 
        self.assertPathExists(bzr_log)
 
115
        self.failIfExists(default_log)
 
116
        self.failUnlessExists(bzr_log)
117
117
 
118
118
    def test_dev_null(self):
119
119
        # This test uses a subprocess to cause the log opening logic to
122
122
            bzr_log = 'NUL'
123
123
        else:
124
124
            bzr_log = '/dev/null'
125
 
        self.overrideEnv('BZR_LOG', bzr_log)
 
125
        osutils.set_or_unset_env('BZR_LOG', bzr_log)
126
126
        default_log = os.path.join(os.environ['BZR_HOME'], '.bzr.log')
127
 
        self.assertPathDoesNotExist(default_log)
 
127
        self.failIfExists(default_log)
128
128
        out = self.run_bzr_subprocess('version')[0]
129
129
        self.assertTrue(len(out) > 0)
130
130
        self.assertContainsRe(out, r"(?m)^  Bazaar log file: " + bzr_log)
131
 
        self.assertPathDoesNotExist(default_log)
 
131
        self.failIfExists(default_log)