~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2006-03-06 07:11:09 UTC
  • mfrom: (1591 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1593.
  • Revision ID: mbp@sourcefrog.net-20060306071109-6b35534e38610c43
[merge] bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
837
837
        self.runbzr('missing ../missing/new-branch')
838
838
 
839
839
    def test_external_command(self):
840
 
        """test that external commands can be run by setting the path"""
 
840
        """Test that external commands can be run by setting the path
 
841
        """
 
842
        # We don't at present run bzr in a subprocess for blackbox tests, and so 
 
843
        # don't really capture stdout, only the internal python stream.
 
844
        # Therefore we don't use a subcommand that produces any output or does
 
845
        # anything -- we just check that it can be run successfully.  
841
846
        cmd_name = 'test-command'
842
 
        output = 'Hello from test-command'
843
847
        if sys.platform == 'win32':
844
848
            cmd_name += '.bat'
845
 
            output += '\r\n'
846
 
        else:
847
 
            output += '\n'
848
 
 
849
849
        oldpath = os.environ.get('BZRPATH', None)
850
 
 
851
850
        bzr = self.capture
852
 
 
853
851
        try:
854
852
            if os.environ.has_key('BZRPATH'):
855
853
                del os.environ['BZRPATH']
859
857
                f.write('@echo off\n')
860
858
            else:
861
859
                f.write('#!/bin/sh\n')
862
 
            f.write('echo Hello from test-command')
 
860
            # f.write('echo Hello from test-command')
863
861
            f.close()
864
862
            os.chmod(cmd_name, 0755)
865
863
 
871
869
            os.environ['BZRPATH'] = '.'
872
870
 
873
871
            bzr(cmd_name)
874
 
            # The test suite does not capture stdout for external commands
875
 
            # this is because you have to have a real file object
876
 
            # to pass to Popen(stdout=FOO), and StringIO is not one of those.
877
 
            # (just replacing sys.stdout does not change a spawned objects stdout)
878
 
            #self.assertEquals(bzr(cmd_name), output)
879
872
 
880
873
            # Make sure empty path elements are ignored
881
874
            os.environ['BZRPATH'] = os.pathsep