~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_script.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-11-05 17:39:54 UTC
  • mfrom: (5524.1.2 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20101105173954-s66k204jmq4ts8l1
(vila) Open trunk again as 2.3dev4 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
161
161
class TestExecution(script.TestCaseWithTransportAndScript):
162
162
 
163
163
    def test_unknown_command(self):
164
 
        self.assertRaises(SyntaxError, self.run_script, 'foo')
 
164
        """A clear error is reported for commands that aren't recognised
 
165
 
 
166
        Testing the attributes of the SyntaxError instance is equivalent to
 
167
        using traceback.format_exception_only and comparing with:
 
168
          File "<string>", line 1
 
169
            foo --frob
 
170
            ^
 
171
        SyntaxError: Command not found "foo"
 
172
        """
 
173
        e = self.assertRaises(SyntaxError, self.run_script, "$ foo --frob")
 
174
        self.assertContainsRe(e.msg, "not found.*foo")
 
175
        self.assertEquals(e.text, "foo --frob")
165
176
 
166
177
    def test_blank_output_mismatches_output(self):
167
178
        """If you give output, the output must actually be blank.