#how to write tests for systems that use AsyncComputeTaskPool?

1 messages · Page 1 of 1 (latest)

dire kernel
#

I've been writing my tests something like this and it works fine. But since async tasks can span multiple updates, how can I update multiple times until the task is done and i can assert the state changes?

let mut app = AppBuilder::new();
app.add_system(do_stuff);

// some logic

app.update();

// assert things
dire kernel
#

trying this but it panics with called Option::unwrap() on a None value in bevy_tasks/src/task_pool which doesn't tell me much.

let mut task = //.. get task via app.world.query

future::block_on(future::poll_once(&mut task.0));
app.update();

// asserts
dire kernel
#

aah ok so the panic was because i need MinimalPlugins included during tests i guess, still not sure how to wait for task to finish tho