def test_labeled_out(self): with FakeEcho.simple('testing') as fe: labeled_out('testing') assert fe.was_called() with FakeEcho.simple('ERROR: testing') as fe: labeled_out('testing', label='ERROR') assert fe.was_called()
def test_verbose_out_verbose(self): with Options(verbose=1): with FakeEcho.simple('test', fg='white') as fe: verbose_out('test', fg='white') assert fe.was_called() with FakeEcho.simple('test', fg='green') as fe: verbose_out('test') assert fe.was_called()
def test_out_ignore_quiet(self): with Options(quiet=True): with FakeEcho.simple('test') as fe: out('test', respect_quiet=False) assert fe.was_called() with FakeEcho.simple('test') as fe: out('test', respect_quiet=False) assert fe.was_called()
def test_warn_out(self): with FakeEcho.simple('Warning: testing', fg='yellow') as fe: warn('testing') assert fe.was_called() with FakeEcho.simple('ERROR: testing', fg='yellow') as fe: warn('testing', label='ERROR') assert fe.was_called() with Options(quiet=True): with FakeEcho.simple('Warning: testing', fg='yellow') as fe: warn('testing') assert fe.was_called()
def test_verbose_output(self): cmd_line = ['ls', '-l'] with Options(verbose=1): with FakeEcho.simple('Running: ls -l', fg='green') as fe: with FakeProcessContext(FakeProcess(cmd_line)): checked_run(cmd_line, 'Testing') assert fe.was_called()
def test_end(self): with FakeEcho.simple('ERROR: boom!', fg='bright_red') as fe: with pytest.raises(SystemExit): end('boom!') assert fe.was_called()
def test_simple_verbose_out(self): with FakeEcho.simple('test') as fe: verbose_out('test') assert not fe.was_called()
def test_out_quiet(self): with Options(quiet=True): with FakeEcho.simple('test') as fe: out('test') assert not fe.was_called()
def test_out_with_kwargs(self): with FakeEcho.simple('test', fg='white') as fe: out('test', fg='white') assert fe.was_called()
def test_bad_module_import(self): with FakeImporter(fail=True): with FakeEcho.simple( 'Warning: Exception loading module for test: boom!', fg='yellow'): assert get_language_module('test') is None