-
Notifications
You must be signed in to change notification settings - Fork 12
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
Check if container components are started #111
Conversation
a93d5b2
to
214a733
Compare
for more information, see https://pre-commit.ci
It should find all the container components recursively, yes? |
Yes, the tests will check that. |
The one problem I (still) have with this is that such issues won't be caught in any tests, since only the runner will check for them. |
Sure, but don't you think that in tests we know better what we are doing, as developers, and that what we want to prevent is users forgetting to start child components? Also, I think that if we forget to start a container component in tests, they will very likely fail. |
I'm not quite grasping your logic here. What's the use case that would pass tests but fail at run time, necessitating this change? |
All I'm saying is that if we forget to start a container component, some resources won't be added and this is likely to have visible consequences in tests, which should probably fail. |
Sure, but if those tests fail, what do we need this extra check for in the runner? |
The runner is a user-facing API, and I think it is fine if it offers more features than running components with a lower-level API as it is done in tests. The problem with container components not started in a user application is that the app will not necessarily crash, but it will behave in a way that can be hard to debug. For instance, a file change watcher that doesn't notify file changes; it will need to identify where the issue comes from, etc. And users don't necessarily write exhaustive tests for their app, so it is nice to catch these errors ahead of time. |
This may be a bad example; I at least don't see how this relates to container components.
But that's just it – you'd have to explicitly check that
Again, how would that work? Didn't we already establish that that the superclass cannot raise any alarms unless the superclass method is called, at which point you wouldn't have to do it anyway? I don't see any way out of this without a |
The service that watches file changes would be added by a child component that would not have been started by a container component.
I mean with this PR this check is done automatically for you.
Yes it might not be possible, that's why I think this PR is at least an improvement, as it won't let you start the application if a container component forgets to |
Obsoleted by #119. |
@agronholm This is what I was thinking about, to check if container components are started. I can add tests if you think this is fine.