~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: 2010-11-05 20:54:32 UTC
  • mfrom: (5526 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5527.
  • Revision ID: john@arbash-meinel.com-20101105205432-rmyozu8sthyhmri8
Merge bzr.dev to resolve bzr-2.3.txt (aka NEWS)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
    commands,
20
20
    osutils,
21
21
    tests,
 
22
    trace,
22
23
    ui,
23
24
    )
24
25
from bzrlib.tests import script
160
161
class TestExecution(script.TestCaseWithTransportAndScript):
161
162
 
162
163
    def test_unknown_command(self):
163
 
        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")
164
176
 
165
177
    def test_blank_output_mismatches_output(self):
166
178
        """If you give output, the output must actually be blank.
272
284
cat dog "chicken" 'dragon'
273
285
""")
274
286
 
 
287
    def test_verbosity_isolated(self):
 
288
        """Global verbosity is isolated from commands run in scripts.
 
289
        """
 
290
        # see also 656694; we should get rid of global verbosity
 
291
        self.run_script("""
 
292
        $ bzr init --quiet a
 
293
        """)
 
294
        self.assertEquals(trace.is_quiet(), False)
 
295
 
275
296
 
276
297
class TestCat(script.TestCaseWithTransportAndScript):
277
298