~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_trace.py

  • Committer: Andrew Bennetts
  • Date: 2010-11-22 03:35:24 UTC
  • mto: This revision was merged to the branch mainline in revision 5547.
  • Revision ID: andrew.bennetts@canonical.com-20101122033524-ouxj0onm3gtkimx3
Remove RepositoryFormatCHK1 and RepositoryFormatCHK2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2011 Canonical Ltd
 
1
# Copyright (C) 2005-2010 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
113
113
        msg = _format_exception()
114
114
        # Even though Windows and Linux differ for 'os.rmdir', they both give
115
115
        # 'No such file' for open()
116
 
        # However it now gets translated so we can not test for a specific message
117
116
        self.assertContainsRe(msg,
118
 
            r'^bzr: ERROR: \[Errno .*\] .*nosuchfile')
 
117
            r'^bzr: ERROR: \[Errno .*\] No such file.*nosuchfile')
119
118
 
120
119
    def test_format_pywintypes_error(self):
121
120
        self.requireFeature(features.pywintypes)
129
128
        #                with errno, function name, and locale error message
130
129
        self.assertContainsRe(msg,
131
130
            r"^bzr: ERROR: \(2, 'RemoveDirectory[AW]?', .*\)")
132
 
            
133
 
    def test_format_sockets_error(self):
134
 
        try:
135
 
            import socket
136
 
            sock = socket.socket()
137
 
            sock.send("This should fail.")
138
 
        except socket.error:
139
 
            pass
140
 
        msg = _format_exception()
141
 
        
142
 
        self.assertNotContainsRe(msg,
143
 
            r"Traceback (most recent call last):")
144
131
 
145
132
    def test_format_unicode_error(self):
146
133
        try:
314
301
        # set up.
315
302
        self.overrideAttr(sys, 'stderr', StringIO())
316
303
        # Set the log file to something that cannot exist
317
 
        self.overrideEnv('BZR_LOG', os.getcwd() + '/no-dir/bzr.log')
 
304
        # FIXME: A bit dangerous: we are not in an isolated dir here -- vilajam
 
305
        # 20100125
 
306
        os.environ['BZR_LOG'] = os.getcwd() + '/no-dir/bzr.log'
318
307
        self.overrideAttr(trace, '_bzr_log_filename')
319
308
        logf = trace._open_bzr_log()
320
309
        self.assertIs(None, logf)