Example #1
0
 def test_verbose_output(self):
     with mock_verbosity(True):
         with captured_output() as (out, err):
             verbose(TEST_MESSAGE)
             self.assertEqual(
                 out.getvalue().strip(),
                 "\x1b[33m==> hokusai exec `%s`\n\x1b[0m" % TEST_MESSAGE)
Example #2
0
 def test_masked_verbose_output(self):
     with mock_verbosity(True):
         with captured_output() as (out, err):
             verbose(TEST_MESSAGE, mask=(r'^(\w*).*$', r'\1 ***'))
             self.assertEqual(
                 out.getvalue().strip(),
                 "\x1b[33m==> hokusai exec `%s`\n\x1b[0m" % 'Ohai ***')
Example #3
0
 def test_non_verbose_output(self):
   with mock_verbosity(False):
     with captured_output() as (out, err):
       verbose(TEST_MESSAGE)
       self.assertEqual(out.getvalue().strip(), '')
Example #4
0
 def test_verbose_returns_input(self):
   with mock_verbosity(True):
     with captured_output() as (out, err):
       msg = verbose(TEST_MESSAGE)
       self.assertEqual(msg, TEST_MESSAGE)