Esempio n. 1
0
def test_prepare_success_properties():
    result = PrepareSuccess(logs=["a"],
                            statuses=(),
                            command_exec_info=None,
                            environ=dict(),
                            overrides=UserConfigOverrides())
    assert result.statuses == ()
    assert result.status_for('FOO') is None
    assert result.status_for(EnvVarRequirement) is None
    assert result.overrides is not None
 def _do_nothing(stage):
     stage.set_result(
         PrepareSuccess(logs=[],
                        statuses=(),
                        command_exec_info=None,
                        environ=dict(),
                        overrides=UserConfigOverrides()),
         [])
     return None
Esempio n. 3
0
 def last(stage):
     assert state['state'] == 'first'
     state['state'] = 'second'
     stage.set_result(
         PrepareSuccess(statuses=(),
                        command_exec_info=None,
                        environ=dict(),
                        overrides=UserConfigOverrides(),
                        env_spec_name='bar'), [])
     return None
Esempio n. 4
0
    def do_first(stage):
        assert state['state'] == 'start'
        state['state'] = 'first'
        stage.set_result(
            PrepareSuccess(
                statuses=(),
                command_exec_info=None,
                environ=dict(),
                overrides=UserConfigOverrides(),
                env_spec_name='first'), [])

        def last(stage):
            assert state['state'] == 'first'
            state['state'] = 'second'
            stage.set_result(
                PrepareFailure(
                    statuses=(), errors=[], environ=dict(), overrides=UserConfigOverrides(), env_spec_name='last'), [])
            return None

        return _FunctionPrepareStage(dict(), UserConfigOverrides(), "second", [], last)