-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Using DefaultPlugins breaks for multiple tests due to LogPlugin #1969
Comments
Just to add some context for my specific problem, I'm using bevy headless with In other words, my use case is pretty niche. Normally I would just ignore this issue because of that but it does seem like this could be a relatively low-hanging fix to remove one of the "global" systems and make this case supported with Note that I do have a work around by copying from the DefaultPlugin minus the LogPlugin so this is not in any way critical: builder
.add_plugin(CorePlugin::default())
.add_plugin(TransformPlugin::default())
// ... etc
; Finally, prior to switching to bevy I was also using tracing and rather than setting the global subscriber directly I was using something like this: let _ = tracing_subscriber::fmt::fmt()
.with_max_level(Level::DEBUG)
.try_init(); This assumes that the failure is always because the global subscriber already exists which the documentation just calls "likely"
|
in builder.add_plugins_with(DefaultPlugins, |group| {
group.disable::<bevy::log::LogPlugin>()
}); |
would the doc added in #1973 be good enough for you to avoid this issue? |
I'm not sure. On one hand the extra documentation is great but on the other removing the LogPlugin still forces users to add their own log handler for tests (or forgo output). I think ideally I would prefer the LogPlugin to survive being used in tests but I can also see the case for just disabling it. I am happy for this to be closed if the other option isn't something that would be desired by others. |
I've got a related issue I think. Whenever I call |
Fixed by #6411. |
Bevy version
0.5
Operating system & version
Ubuntu 18.04
What you did
I am trying to write tests for systems and encounter this error when there are multiple tests
What you expected to happen
Log instances shouldn't conflict
What actually happened
Additional information
A possible fix might be to remove the explicit panics if creating a global subscriber fails
bevy/crates/bevy_log/src/lib.rs
Line 79 in 4a477e7
The text was updated successfully, but these errors were encountered: