1
# Copyright (C) 2005-2010 Canonical Ltd
1
# Copyright (C) 2005-2011 Canonical Ltd
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)
320
if 'BZRPATH' in os.environ:
321
del os.environ['BZRPATH']
323
f = file(cmd_name, 'wb')
324
if sys.platform == 'win32':
325
f.write('@echo off\n')
327
f.write('#!/bin/sh\n')
328
# f.write('echo Hello from test-command')
330
os.chmod(cmd_name, 0755)
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)
336
# Now put it into my path
337
os.environ['BZRPATH'] = '.'
339
self.run_bzr(cmd_name)
341
# Make sure empty path elements are ignored
342
os.environ['BZRPATH'] = os.pathsep
344
self.run_bzr(cmd_name, retcode=3)
348
os.environ['BZRPATH'] = oldpath
318
self.overrideEnv('BZRPATH', None)
320
f = file(cmd_name, 'wb')
321
if sys.platform == 'win32':
322
f.write('@echo off\n')
324
f.write('#!/bin/sh\n')
325
# f.write('echo Hello from test-command')
327
os.chmod(cmd_name, 0755)
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)
333
# Now put it into my path
334
self.overrideEnv('BZRPATH', '.')
335
self.run_bzr(cmd_name)
337
# Make sure empty path elements are ignored
338
self.overrideEnv('BZRPATH', os.pathsep)
339
self.run_bzr(cmd_name, retcode=3)
351
342
def listdir_sorted(dir):