~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_script.py

  • Committer: John Arbash Meinel
  • Date: 2011-01-12 21:27:00 UTC
  • mto: This revision was merged to the branch mainline in revision 5605.
  • Revision ID: john@arbash-meinel.com-20110112212700-esqmtrmevddxrsq2
Clean up the test slightly, hoping to avoid race conditions, update NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
383
383
$ mkdir ../dir2
384
384
$ cd ..
385
385
""")
386
 
        self.assertPathExists('dir')
387
 
        self.assertPathExists('dir2')
 
386
        self.failUnlessExists('dir')
 
387
        self.failUnlessExists('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.assertPathExists('branch')
 
419
        self.failUnlessExists('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.assertPathExists('file')
 
483
        self.failUnlessExists('file')
484
484
        self.run_script('$ rm file')
485
 
        self.assertPathDoesNotExist('file')
 
485
        self.failIfExists('file')
486
486
 
487
487
    def test_rm_file_force(self):
488
 
        self.assertPathDoesNotExist('file')
 
488
        self.failIfExists('file')
489
489
        self.run_script('$ rm -f file')
490
 
        self.assertPathDoesNotExist('file')
 
490
        self.failIfExists('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.assertPathExists('file2')
 
497
        self.failUnlessExists('file2')
498
498
        self.run_script('$ rm file file2')
499
 
        self.assertPathDoesNotExist('file2')
 
499
        self.failIfExists('file2')
500
500
 
501
501
    def test_rm_dir(self):
502
502
        self.run_script('$ mkdir dir')
503
 
        self.assertPathExists('dir')
 
503
        self.failUnlessExists('dir')
504
504
        self.run_script("""
505
505
$ rm dir
506
506
2>rm: cannot remove 'dir': Is a directory
507
507
""")
508
 
        self.assertPathExists('dir')
 
508
        self.failUnlessExists('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.assertPathDoesNotExist('dir')
 
515
        self.failIfExists('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.assertPathExists('file')
 
527
        self.failUnlessExists('file')
528
528
        self.run_script('$ mv file new_name')
529
 
        self.assertPathDoesNotExist('file')
530
 
        self.assertPathExists('new_name')
 
529
        self.failIfExists('file')
 
530
        self.failUnlessExists('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.assertPathDoesNotExist('dir')
543
 
        self.assertPathExists('new_name')
544
 
        self.assertPathExists('new_name/file')
 
542
        self.failIfExists('dir')
 
543
        self.failUnlessExists('new_name')
 
544
        self.failUnlessExists('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.assertPathExists('dir')
553
 
        self.assertPathDoesNotExist('file')
554
 
        self.assertPathExists('dir/file')
 
552
        self.failUnlessExists('dir')
 
553
        self.failIfExists('file')
 
554
        self.failUnlessExists('dir/file')
555
555
 
556
556
 
557
557
class cmd_test_confirm(commands.Command):
558
558
 
559
559
    def run(self):
560
560
        if ui.ui_factory.get_boolean(
561
 
            u'Really do it',
 
561
            'Really do it',
562
562
            # 'bzrlib.tests.test_script.confirm',
563
563
            # {}
564
564
            ):