def test_flow_depends_localpath(monkeypatch):
    monkeypatch.setattr(dependencies, 'change_cwd', nullcontext)
    monkeypatch.setattr(dependencies, 'get_workspace_path', lambda *args: filename)
    f = FlowDepends(DaemonID('jworkspace'), filename, Environment(envs=['a=b']))
    assert str(f.localpath()) == filename

    with pytest.raises(HTTPException) as e:
        monkeypatch.setattr(dependencies, "get_workspace_path", lambda *args: 'abc')
        f = FlowDepends(DaemonID('jworkspace'), filename, Environment(envs=['a=b']))
        f.localpath()
示例#2
0
def test_flow_depends_localpath(monkeypatch):
    monkeypatch.setattr(dependencies, "get_workspace_path",
                        lambda *args: filename)
    f = FlowDepends(DaemonID('jworkspace'), filename)
    assert str(f.localpath()) == filename

    with pytest.raises(HTTPException) as e:
        monkeypatch.setattr(dependencies, "get_workspace_path",
                            lambda *args: 'abc')
        f = FlowDepends(DaemonID('jworkspace'), filename)
        f.localpath()
示例#3
0
def test_flow_depends_localpath(monkeypatch, tmpdir):
    filename = os.path.join(cur_dir, 'flow1.yml')
    monkeypatch.setattr(dependencies, 'change_cwd', nullcontext)
    monkeypatch.setattr(dependencies, 'get_workspace_path', lambda *args: filename)
    monkeypatch.setattr(FlowDepends, 'newfile', os.path.join(tmpdir, 'abc.yml'))
    f = FlowDepends(DaemonID('jworkspace'), filename, Environment(envs=['a=b']))
    assert str(f.localpath()) == filename

    with pytest.raises(HTTPException) as e:
        monkeypatch.setattr(dependencies, "get_workspace_path", lambda *args: 'abc')
        f = FlowDepends(DaemonID('jworkspace'), filename, Environment(envs=['a=b']))
        f.localpath()