~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_script.py

  • Committer: Martin Pool
  • Date: 2011-04-15 07:01:22 UTC
  • mto: This revision was merged to the branch mainline in revision 5789.
  • Revision ID: mbp@sourcefrog.net-20110415070122-7x24skeadcm7wvut
Switch away from using failUnlessExists and failIfExists

Show diffs side-by-side

added added

removed removed

Lines of Context:
383
383
$ mkdir ../dir2
384
384
$ cd ..
385
385
""")
386
 
        self.failUnlessExists('dir')
387
 
        self.failUnlessExists('dir2')
 
386
        self.assertPathExists('dir')
 
387
        self.assertPathExists('dir2')
388
388
 
389
389
 
390
390
class TestCd(script.TestCaseWithTransportAndScript):
416
416
            $ bzr init branch
417
417
            Created a standalone tree (format: ...)
418
418
            """)
419
 
        self.failUnlessExists('branch')
 
419
        self.assertPathExists('branch')
420
420
 
421
421
 
422
422
class TestEcho(script.TestCaseWithMemoryTransportAndScript):
480
480
 
481
481
    def test_rm_file(self):
482
482
        self.run_script('$ echo content >file')
483
 
        self.failUnlessExists('file')
 
483
        self.assertPathExists('file')
484
484
        self.run_script('$ rm file')
485
 
        self.failIfExists('file')
 
485
        self.assertPathDoesNotExist('file')
486
486
 
487
487
    def test_rm_file_force(self):
488
 
        self.failIfExists('file')
 
488
        self.assertPathDoesNotExist('file')
489
489
        self.run_script('$ rm -f file')
490
 
        self.failIfExists('file')
 
490
        self.assertPathDoesNotExist('file')
491
491
 
492
492
    def test_rm_files(self):
493
493
        self.run_script("""
494
494
$ echo content >file
495
495
$ echo content >file2
496
496
""")
497
 
        self.failUnlessExists('file2')
 
497
        self.assertPathExists('file2')
498
498
        self.run_script('$ rm file file2')
499
 
        self.failIfExists('file2')
 
499
        self.assertPathDoesNotExist('file2')
500
500
 
501
501
    def test_rm_dir(self):
502
502
        self.run_script('$ mkdir dir')
503
 
        self.failUnlessExists('dir')
 
503
        self.assertPathExists('dir')
504
504
        self.run_script("""
505
505
$ rm dir
506
506
2>rm: cannot remove 'dir': Is a directory
507
507
""")
508
 
        self.failUnlessExists('dir')
 
508
        self.assertPathExists('dir')
509
509
 
510
510
    def test_rm_dir_recursive(self):
511
511
        self.run_script("""
512
512
$ mkdir dir
513
513
$ rm -r dir
514
514
""")
515
 
        self.failIfExists('dir')
 
515
        self.assertPathDoesNotExist('dir')
516
516
 
517
517
 
518
518
class TestMv(script.TestCaseWithTransportAndScript):
524
524
 
525
525
    def test_move_file(self):
526
526
        self.run_script('$ echo content >file')
527
 
        self.failUnlessExists('file')
 
527
        self.assertPathExists('file')
528
528
        self.run_script('$ mv file new_name')
529
 
        self.failIfExists('file')
530
 
        self.failUnlessExists('new_name')
 
529
        self.assertPathDoesNotExist('file')
 
530
        self.assertPathExists('new_name')
531
531
 
532
532
    def test_move_unknown_file(self):
533
533
        self.assertRaises(AssertionError,
539
539
$ echo content >dir/file
540
540
""")
541
541
        self.run_script('$ mv dir new_name')
542
 
        self.failIfExists('dir')
543
 
        self.failUnlessExists('new_name')
544
 
        self.failUnlessExists('new_name/file')
 
542
        self.assertPathDoesNotExist('dir')
 
543
        self.assertPathExists('new_name')
 
544
        self.assertPathExists('new_name/file')
545
545
 
546
546
    def test_move_file_into_dir(self):
547
547
        self.run_script("""
549
549
$ echo content > file
550
550
""")
551
551
        self.run_script('$ mv file dir')
552
 
        self.failUnlessExists('dir')
553
 
        self.failIfExists('file')
554
 
        self.failUnlessExists('dir/file')
 
552
        self.assertPathExists('dir')
 
553
        self.assertPathDoesNotExist('file')
 
554
        self.assertPathExists('dir/file')
555
555
 
556
556
 
557
557
class cmd_test_confirm(commands.Command):