-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Cannot create Bevy app in tests due to non-main thread #1720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I agree with this. The actual solution to this problem is likely to define better testing idioms / harnesses for integration testing of Bevy apps. |
More discussion of this issue on Discord. TL;DR:
|
You can already For example, for keyboard, you can send an event bevy/crates/bevy_input/src/keyboard.rs Lines 7 to 11 in 3a2a688
If you are using a bevy/crates/bevy_input/src/keyboard.rs Lines 14 to 17 in 3a2a688
|
This is now definitely resolved! I have integration tests working here. |
This is still not fully resolved: |
Bevy version
The release number or commit hash of the version you're using.
Operating system & version
Windows 10, VSCode, commit: 348e2a3
What you did
What you expected to happen
I would be able to spawn Bevy apps within my tests.
What actually happened
Using
cargo test
fails:Running just the single test reveals:
Additional information
This fails for
DefaultPlugins
but notMinimalPlugins
.#1714 has great guidance on how to test individual systems, but this doesn't suffice for full integration tests (and this failure is frustrating for beginners).
@mockersf suggested that I try running the test using only 1 thread, as described here. Using
cargo test -- --test-threads=1
solves the issue, but this is a nuisance to remember to do every time (and I only want to run the main-thread-only tests on the main thread).The text was updated successfully, but these errors were encountered: