~abentley/bzr/cp-4470

« back to all changes in this revision

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

  • Committer: Launchpad Patch Queue Manager
  • Date: 2009-03-16 11:57:58 UTC
  • mfrom: (3995.3.115 1.13-for-rf)
  • Revision ID: launchpad@pqm.canonical.com-20090316115758-hkrp6igwb4vyt94l
[rs=mwhudson] bzr 1.13

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
"""Black-box tests for bzr.
23
23
 
24
24
These check that it behaves properly when it's invoked through the regular
25
 
command-line interface. This doesn't actually run a new interpreter but 
 
25
command-line interface. This doesn't actually run a new interpreter but
26
26
rather starts again from the run_bzr function.
27
27
"""
28
28
 
101
101
                             os.readlink('symlink'))
102
102
        else:
103
103
            self.log("skipping revert symlink tests")
104
 
        
 
104
 
105
105
        file('hello', 'wt').write('xyz')
106
106
        self.run_bzr('commit -m xyz hello')
107
107
        self.run_bzr('revert -r 1 hello')
174
174
        added_message = out.find('message:\n  foo')
175
175
        self.failIfEqual(added_message, -1)
176
176
        self.failUnless(added_loc < added_message)
177
 
        
 
177
 
178
178
    def test_locations(self):
179
179
        """Using and remembering different locations"""
180
180
        os.mkdir('a')
202
202
        self.run_bzr('pull', retcode=3)
203
203
        self.run_bzr('pull ../a --remember')
204
204
        self.run_bzr('pull')
205
 
        
 
205
 
206
206
    def test_unknown_command(self):
207
207
        """Handling of unknown command."""
208
208
        out, err = self.run_bzr('fluffy-badger', retcode=3)
315
315
        self.run_bzr('push --overwrite')
316
316
        # nothing missing
317
317
        self.run_bzr('missing ../output-branch')
318
 
        
 
318
 
319
319
        # pushing to a new dir with no parent should fail
320
320
        self.run_bzr('push ../missing/new-branch', retcode=3)
321
321
        # unless we provide --create-prefix
326
326
    def test_external_command(self):
327
327
        """Test that external commands can be run by setting the path
328
328
        """
329
 
        # We don't at present run bzr in a subprocess for blackbox tests, and so 
 
329
        # We don't at present run bzr in a subprocess for blackbox tests, and so
330
330
        # don't really capture stdout, only the internal python stream.
331
331
        # Therefore we don't use a subcommand that produces any output or does
332
 
        # anything -- we just check that it can be run successfully.  
 
332
        # anything -- we just check that it can be run successfully.
333
333
        cmd_name = 'test-command'
334
334
        if sys.platform == 'win32':
335
335
            cmd_name += '.bat'
347
347
            f.close()
348
348
            os.chmod(cmd_name, 0755)
349
349
 
350
 
            # It should not find the command in the local 
 
350
            # It should not find the command in the local
351
351
            # directory by default, since it is not in my path
352
352
            self.run_bzr(cmd_name, retcode=3)
353
353
 
433
433
        f.close()
434
434
 
435
435
        self.run_bzr("add hello.txt")
436
 
        
 
436
 
437
437
        f = file('msg.tmp', 'wt')
438
438
        f.write('this is my new commit\nand it has multiple lines, for fun')
439
439
        f.close()
602
602
        url = self.get_readonly_url('branch/file')
603
603
        output = self.run_bzr('log %s' % url)[0]
604
604
        self.assertEqual(8, len(output.split('\n')))
605
 
        
 
605
 
606
606
    def test_check(self):
607
607
        self.build_tree(['branch/', 'branch/file'])
608
608
        self.run_bzr('init branch')[0]
610
610
        self.run_bzr('commit -m foo branch')[0]
611
611
        url = self.get_readonly_url('branch/')
612
612
        self.run_bzr(['check', url])
613
 
    
 
613
 
614
614
    def test_push(self):
615
615
        # create a source branch
616
616
        os.mkdir('my-branch')
623
623
        # with an explicit target work
624
624
        self.run_bzr(['push', self.get_url('output-branch')])
625
625
 
626
 
    
 
626
 
627
627
class HTTPTests(TestCaseWithWebserver, RemoteTests):
628
628
    """Test various commands against a HTTP server."""
629
 
    
630
 
    
 
629
 
 
630
 
631
631
class SFTPTestsAbsolute(TestCaseWithSFTPServer, RemoteTests):
632
632
    """Test various commands against a SFTP server using abs paths."""
633
633
 
634
 
    
 
634
 
635
635
class SFTPTestsAbsoluteSibling(TestCaseWithSFTPServer, RemoteTests):
636
636
    """Test various commands against a SFTP server using abs paths."""
637
637
 
639
639
        super(SFTPTestsAbsoluteSibling, self).setUp()
640
640
        self._override_home = '/dev/noone/runs/tests/here'
641
641
 
642
 
    
 
642
 
643
643
class SFTPTestsRelative(TestCaseWithSFTPServer, RemoteTests):
644
644
    """Test various commands against a SFTP server using homedir rel paths."""
645
645