~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2011-05-11 11:35:28 UTC
  • mto: This revision was merged to the branch mainline in revision 5851.
  • Revision ID: john@arbash-meinel.com-20110511113528-qepibuwxicjrbb2h
Break compatibility with python <2.6.

This includes auditing the code for places where we were doing
explicit 'sys.version' checks and removing them as appropriate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005-2011 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
88
88
            self.run_bzr('commit -m f')
89
89
            os.unlink('symlink')
90
90
            self.run_bzr('revert')
91
 
            self.failUnlessExists('symlink')
 
91
            self.assertPathExists('symlink')
92
92
            os.unlink('symlink')
93
93
            os.symlink('a-different-path', 'symlink')
94
94
            self.run_bzr('revert')
133
133
 
134
134
        os.chdir('../a')
135
135
        out = self.run_bzr('pull --verbose ../b')[0]
136
 
        self.failIfEqual(out.find('Added Revisions:'), -1)
137
 
        self.failIfEqual(out.find('message:\n  added b'), -1)
138
 
        self.failIfEqual(out.find('added b'), -1)
 
136
        self.assertNotEqual(out.find('Added Revisions:'), -1)
 
137
        self.assertNotEqual(out.find('message:\n  added b'), -1)
 
138
        self.assertNotEqual(out.find('added b'), -1)
139
139
 
140
140
        # Check that --overwrite --verbose prints out the removed entries
141
141
        self.run_bzr('commit -m foo --unchanged')
145
145
        out = self.run_bzr('pull --overwrite --verbose ../a')[0]
146
146
 
147
147
        remove_loc = out.find('Removed Revisions:')
148
 
        self.failIfEqual(remove_loc, -1)
 
148
        self.assertNotEqual(remove_loc, -1)
149
149
        added_loc = out.find('Added Revisions:')
150
 
        self.failIfEqual(added_loc, -1)
 
150
        self.assertNotEqual(added_loc, -1)
151
151
 
152
152
        removed_message = out.find('message:\n  baz')
153
 
        self.failIfEqual(removed_message, -1)
154
 
        self.failUnless(remove_loc < removed_message < added_loc)
 
153
        self.assertNotEqual(removed_message, -1)
 
154
        self.assertTrue(remove_loc < removed_message < added_loc)
155
155
 
156
156
        added_message = out.find('message:\n  foo')
157
 
        self.failIfEqual(added_message, -1)
158
 
        self.failUnless(added_loc < added_message)
 
157
        self.assertNotEqual(added_message, -1)
 
158
        self.assertTrue(added_loc < added_message)
159
159
 
160
160
    def test_locations(self):
161
161
        """Using and remembering different locations"""
315
315
        cmd_name = 'test-command'
316
316
        if sys.platform == 'win32':
317
317
            cmd_name += '.bat'
318
 
        oldpath = os.environ.get('BZRPATH', None)
319
 
        try:
320
 
            if 'BZRPATH' in os.environ:
321
 
                del os.environ['BZRPATH']
322
 
 
323
 
            f = file(cmd_name, 'wb')
324
 
            if sys.platform == 'win32':
325
 
                f.write('@echo off\n')
326
 
            else:
327
 
                f.write('#!/bin/sh\n')
328
 
            # f.write('echo Hello from test-command')
329
 
            f.close()
330
 
            os.chmod(cmd_name, 0755)
331
 
 
332
 
            # It should not find the command in the local
333
 
            # directory by default, since it is not in my path
334
 
            self.run_bzr(cmd_name, retcode=3)
335
 
 
336
 
            # Now put it into my path
337
 
            os.environ['BZRPATH'] = '.'
338
 
 
339
 
            self.run_bzr(cmd_name)
340
 
 
341
 
            # Make sure empty path elements are ignored
342
 
            os.environ['BZRPATH'] = os.pathsep
343
 
 
344
 
            self.run_bzr(cmd_name, retcode=3)
345
 
 
346
 
        finally:
347
 
            if oldpath:
348
 
                os.environ['BZRPATH'] = oldpath
 
318
        self.overrideEnv('BZRPATH', None)
 
319
 
 
320
        f = file(cmd_name, 'wb')
 
321
        if sys.platform == 'win32':
 
322
            f.write('@echo off\n')
 
323
        else:
 
324
            f.write('#!/bin/sh\n')
 
325
        # f.write('echo Hello from test-command')
 
326
        f.close()
 
327
        os.chmod(cmd_name, 0755)
 
328
 
 
329
        # It should not find the command in the local
 
330
        # directory by default, since it is not in my path
 
331
        self.run_bzr(cmd_name, retcode=3)
 
332
 
 
333
        # Now put it into my path
 
334
        self.overrideEnv('BZRPATH', '.')
 
335
        self.run_bzr(cmd_name)
 
336
 
 
337
        # Make sure empty path elements are ignored
 
338
        self.overrideEnv('BZRPATH', os.pathsep)
 
339
        self.run_bzr(cmd_name, retcode=3)
349
340
 
350
341
 
351
342
def listdir_sorted(dir):