for the testing im trying to ```@pytest.mark.async...
# ask-ai
c
for the testing im trying to
Copy code
@pytest.mark.asyncio
async def test_complex_flow_add_remove_then_reservation_then_continue_and_confirm_delivery() -> None:
    userdata, agent = myconfig()
    async with (
        agent.llm as llm,
        agent as sess,
    ):
        await sess.start(userdata.agents["commande"])
        r1 = await sess.run(user_input="Je veux une 4 fromages")
        r1.expect.skip_next_event_if(type="message", role="assistant")
        r1.expect.next_event().is_function_call(name="update_order")
        assert len(userdata.order) == 1
        r2 = await sess.run(user_input="Finalement je la veux plus")
but the second sess.run is not working i got RuntimeError: AgentSession is closing, cannot use generate_reply()
t
Thanks for reaching out, Antoine. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks for reaching out! Could you please share a bit more about how the
agent
and
userdata
objects are initialized in your test setup? Also, if there are any particular steps or configurations in your
myconfig()
function that might influence the session lifecycle, it would be great to know. I’m here to help you get this sorted out!