Пример #1
0
def test_check_startup_opts(opts_to_test: List[str], is_restart: bool,
                            err_msg: str) -> None:
    """Test Scheduler._check_startup_opts()"""
    for opt in opts_to_test:
        mocked_scheduler = Mock(is_restart=is_restart)
        mocked_scheduler.options = SimpleNamespace(**{opt: 'reload'})
        with pytest.raises(UserInputError) as excinfo:
            Scheduler._check_startup_opts(mocked_scheduler)
        assert (err_msg.format(opt) in str(excinfo))
Пример #2
0
def test_check_startup_opts(opts: Dict[str, Optional[str]], is_restart: bool,
                            err: List[str]):
    """Test Scheduler.process_cycle_point_opts()"""
    mocked_scheduler = Mock()
    mocked_scheduler.options = Mock(spec=[], **opts)
    mocked_scheduler.is_restart = is_restart
    with pytest.raises(SchedulerError) as excinfo:
        Scheduler._check_startup_opts(mocked_scheduler)
    assert (err in str(excinfo))