def ps3_copy(pProc1, pProc2, pProc3): return ProcSet(pProc1, pProc2, pProc3, id='ps3_copy', depends=False, copy=True)
def ps3_copy_depends(pProc1, pProc2, pProc3): return ProcSet(pProc1, pProc2, pProc3, id='ps3_copy_depends', depends=True, copy=True)
def test_proc_setattr(tmpdir, caplog): p3 = Proc() with pytest.raises(ProcAttributeError): p3.x = 1 p3.preCmd = 'ls' assert 'beforeCmd' in p3.sets p4 = Proc() ps = ProcSet(p4) p3.depends = p4 assert p3.depends == [p4] p3.depends = [p4], ps assert p3.depends == [p4, ps.p4] assert p4.tag == 'notag' assert ps.p4.tag == 'notag@ps' with pytest.raises(ProcAttributeError): p3.depends = p3 with pytest.raises(ProcAttributeError): p3.depends = object() p3.script = 'file:%s' % Path(__file__).name assert p3.config.script == 'file:%s' % Path(__file__).resolve() p31 = Proc(script='file:%s' % Path(__file__).name) assert p31.config.script == 'file:%s' % Path(__file__).resolve() with pytest.raises(ProcAttributeError): p3.script = 'file:nosuchfile' p3.args = {'a': 1} assert p3.args.a == 1 p3.input = 'a, b' p3.input = [1, 2] assert p3.config.input == {'a, b': [1, 2]} p3.input = {'a': [1], 'b': [2]} caplog.clear() p3.input = [3, 4] assert 'Previous input is a dict with multiple keys and key order may be changed.' in caplog.text assert 'Now the key order is:' in caplog.text p3.runner = 'sge' assert p3.config.runner == 'sge' assert p3.props.runner == 'sge' with pytest.raises(ProcAttributeError): p3.tag = 'a@b'
def ps3(pProc1, pProc2, pProc3): return ProcSet(pProc1, pProc2, pProc3, id='ps3', depends=False, copy=False)
def empty_ps(): return ProcSet(id='empty_ps')
def psp3(pProc1, pProc2, pProc3): return PSProxy(procset=ProcSet(pProc1, pProc2, pProc3))
def empty_psp(): return PSProxy(procset=ProcSet())
def test_name(): p61 = Proc() assert p61.name() == 'p61' ps = ProcSet(p61) assert ps.p61.tag == 'notag@ps' assert ps.p61.name(True) == 'p61@ps'