def test_cmdline_vars(self, monkeypatch): mock_run = Mock() monkeypatch.setattr(Run, "execute", mock_run) cmd_main(['x=1', 'y=abc']) assert '1' == doit_cmd.get_var('x') assert 'abc' == doit_cmd.get_var('y') assert None is doit_cmd.get_var('z')
def test_cmdline_novars(self, monkeypatch): mock_run = Mock() monkeypatch.setattr(Run, "execute", mock_run) cmd_main(['x=1']) # Simulate the variable below not being initialized by a subprocess on # Windows. See https://github.com/pydoit/doit/issues/164. doit_cmd._CMDLINE_VARS = None assert None is doit_cmd.get_var('x')
def check_success(self): """check if task should succeed based on GLOBAL parameter""" return doit_cmd.get_var('success', False)
def test_cmdline_vars_not_opts(self, monkeypatch): mock_run = Mock() monkeypatch.setattr(Run, "execute", mock_run) cmd_main(['--z=5']) assert None == doit_cmd.get_var('--z')