def test_context_manager_is_properly_applied_to_tasks(): t1 = Task() t2 = Task() t3 = Task() with Flow(name="test") as f1: with Flow(name="test") as f2: t2.bind() t1.bind() with pytest.raises(ValueError): t3.bind() assert f1.tasks == set([t1]) assert f2.tasks == set([t2])
def test_binding_a_task_adds_it_to_flow(): flow = Flow(name="test") t = Task() assert t not in flow.tasks t.bind(flow=flow) assert t in flow.tasks
def test_binding_a_task_no_with_flow_raises_error(): t = Task() with pytest.raises(ValueError): t.bind()
def test_binding_a_task_in_context_adds_it_to_flow(): with Flow(name="test") as flow: t = Task() assert t not in flow.tasks t.bind() assert t in flow.tasks