-
Notifications
You must be signed in to change notification settings - Fork 64
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
Mock providers don't seem to be loaded on an non-RPi system #368
Comments
@FDelporte I see the Core tests cases now use this new means to create the context. So that is what I think happened, you asked what we should do.
Since @eitch added a specific means to load the Mocks I want his opinion. I think under the covers is not the way as one, I dislike magic happening unknown to me, and two, what about other providers that may successfully load whether ours or some user implemented providers. Should they be permitted ? Seems a slippery slope. |
I think this can be solved by changing this line: com/pi4j/context/impl/DefaultContextBuilder.java:54 from:
to
What do you think? |
See #373 |
I think that is a good solution. Let me know if u want me to assist in further web doc reviews for this work. As it does change behavior you earlier asked about new releases or a point for the ongoing changes. I think this change is a new release (i see u have referred to next release in some items so that seems the plan) |
This has now been implemented in #373. Now mocks are loaded on non-rpi systems automatically, but not loaded on the Raspi. The documentation should probably document, that to load mocks on the Raspi, we need to use the following line:
|
will add to release notes and documentation with next version |
Related to Pi4J/pi4j-kotlin#12
When initializing a new context on a non-RPi system, it seems the mock plugin is not loaded. Could this be related to the new priority system for plugins, which was introduced recently?
Fix in code is available like this, as used e.g. in unit tests: https://github.com/Pi4J/pi4j-kotlin/blob/master/lib/src/test/kotlin/com/pi4j/ktx/ContextTest.kt
I think with the right approach, we could prevent the need to manually add the mock for testing on non-RPi-systems, so this code in the Spring Boot Starter would become unnecessary: https://github.com/Pi4J/pi4j-springboot/blob/main/pi4j-spring-boot/src/main/java/com/pi4j/spring/boot/ContextConfiguration.java#L31
The text was updated successfully, but these errors were encountered: