def test_connection_observer_one_exception(): ConnectionObserver.get_unraised_exceptions(True) time.sleep(0.1) from moler.cmd.unix.ls import Ls from moler.exceptions import CommandTimeout cmd = Ls(None) none_exceptions = ConnectionObserver.get_unraised_exceptions(True) assert 0 == len(none_exceptions) cmd.set_exception(CommandTimeout(cmd, 0.1)) cmd._is_done = True active_exceptions = ConnectionObserver.get_unraised_exceptions(True) assert 1 == len(active_exceptions) try: cmd.result() except CommandTimeout: pass none_exceptions = ConnectionObserver.get_unraised_exceptions(True) assert 0 == len(none_exceptions) none_exceptions = ConnectionObserver.get_unraised_exceptions(True) assert 0 == len(none_exceptions)
def test_moler_test_not_raise_exception_when_no_steps_end(moler_test): ConnectionObserver.get_unraised_exceptions() moler_test.test_not_raise_exception_when_no_steps_end()
def test_moler_test_raise_exception_when_log_error_raise_exception_set( moler_test_se): ConnectionObserver.get_unraised_exceptions() with pytest.raises(MolerStatusException): moler_test_se.test_raise_exception_when_log_error_raise_exception_set()
def test_moler_test_test_raise_exception_when_not_call_steps_end( moler_test_se): ConnectionObserver.get_unraised_exceptions() with pytest.raises(MolerStatusException): moler_test_se.test_raise_exception_when_not_call_steps_end()
def test_moler_test_wrapper(): ConnectionObserver.get_unraised_exceptions() decorated = moler_test_raise_exception_when_no_steps_end_for_global_method ret = MolerTest._wrapper(decorated, False) assert decorated == ret
def test_moler_test_raise_exception_when_not_callable_passed(): ConnectionObserver.get_unraised_exceptions() var = "no callable" with pytest.raises(MolerStatusException): MolerTest._decorate(var)
def test_moler_test_not_raise_exception_when_no_steps_end_for_global_method_twice( ): ConnectionObserver.get_unraised_exceptions() moler_test_not_raise_exception_when_no_steps_end_for_global_method_twice()
def test_moler_test_warn(): ConnectionObserver.get_unraised_exceptions() MolerTest.warning("Warning test")
def test_moler_test_raise_exception_when_no_steps_end_for_global_method(): with pytest.raises(ExecutionException): moler_test_raise_exception_when_no_steps_end_for_global_method() ConnectionObserver.get_unraised_exceptions()
def test_moler_test_raise_exception_when_log_error(moler_test_se): ConnectionObserver.get_unraised_exceptions() with pytest.raises(ExecutionException): moler_test_se.test_raise_exception_when_log_error() ConnectionObserver.get_unraised_exceptions()