~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

merge trunk

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
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):