758
758
# nothing missing
759
759
self.runbzr('missing ../missing/new-branch')
761
def test_external_command(self):
762
"""test that external commands can be run by setting the path"""
763
cmd_name = 'test-command'
764
output = 'Hello from test-command'
765
if sys.platform == 'win32':
771
oldpath = os.environ.get('BZRPATH', None)
776
if os.environ.has_key('BZRPATH'):
777
del os.environ['BZRPATH']
779
f = file(cmd_name, 'wb')
780
if sys.platform == 'win32':
781
f.write('@echo off\n')
783
f.write('#!/bin/sh\n')
784
f.write('echo Hello from test-command')
786
os.chmod(cmd_name, 0755)
788
# It should not find the command in the local
789
# directory by default, since it is not in my path
790
bzr(cmd_name, retcode=1)
792
# Now put it into my path
793
os.environ['BZRPATH'] = '.'
796
# The test suite does not capture stdout for external commands
797
# this is because you have to have a real file object
798
# to pass to Popen(stdout=FOO), and StringIO is not one of those.
799
# (just replacing sys.stdout does not change a spawned objects stdout)
800
#self.assertEquals(bzr(cmd_name), output)
802
# Make sure empty path elements are ignored
803
os.environ['BZRPATH'] = os.pathsep
805
bzr(cmd_name, retcode=1)
809
os.environ['BZRPATH'] = oldpath
762
815
def listdir_sorted(dir):
763
816
L = os.listdir(dir)