~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Rework test_script a little bit.


Don't allow someone to request a stdin request to echo.
Echo never reads from stdin, it just echos its arguments.
You use 'cat' if you want to read from stdin.

A few other fixes because the tests were using filenames
that are actually illegal on Windows, rather than just
nonexistant.


Change the exception handling for commands so that
unknown errors don't get silently squashed and then
turn into hard-to-debug errors later.

test_script now passes on Windows.

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
        f.write("\nsome other new content!")
62
62
        f.close()
63
63
 
64
 
    def run_bzr_remove_changed_files(self, error_regexes, files_to_remove):
 
64
    def run_bzr_remove_changed_files(self, error_regexes, files_to_remove,
 
65
                                     working_dir=None):
65
66
        error_regexes.extend(["Can't safely remove modified or unknown files:",
66
67
            'Use --keep to not delete them,'
67
68
            ' or --force to delete them regardless.'
68
69
            ])
69
70
        self.run_bzr_error(error_regexes,
70
 
            ['remove'] + list(files_to_remove))
 
71
                           ['remove'] + list(files_to_remove),
 
72
                           working_dir=working_dir)
71
73
        #see if we can force it now
72
 
        self.run_bzr(['remove', '--force'] + list(files_to_remove))
 
74
        self.run_bzr(['remove', '--force'] + list(files_to_remove),
 
75
                     working_dir=working_dir)
73
76
 
74
77
    def test_remove_new_no_files_specified(self):
75
78
        tree = self.make_branch_and_tree('.')
196
199
        self.run_bzr("commit -m 'added files'")
197
200
        self.changeFile(a)
198
201
        self.changeFile(c)
199
 
        os.chdir('b')
200
 
        self.run_bzr_remove_changed_files(['modified:[.\s]*a[.\s]*b/c'],
201
 
            ['../a', 'c', '.', '../d'])
202
 
        os.chdir('..')
 
202
        self.run_bzr_remove_changed_files(
 
203
            ['modified:[.\s]*a[.\s]*b/c'],
 
204
            ['../a', 'c', '.', '../d'], working_dir='b')
203
205
        self.assertNotInWorkingTree(files)
204
206
        self.failIfExists(files)
205
207