Skip to content
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

Update Mockup for Pytest for items, plugins and provide basic test case for sample Plugin #361

Open
bmxp opened this issue Sep 26, 2020 · 1 comment
Labels
core Issue relates to the core of SmartomeNG help wanted plugins Issue relates to a plugin

Comments

@bmxp
Copy link
Member

bmxp commented Sep 26, 2020

As SmartHomeNG grows the possibility for errors increases. We should consider to provide tests within the sample plugin thus plugin developers can write tests for their functions.
Before releasing test code within sample plugin, we need to overhaul the mockup of core, plugins, items and logics.
@ohinckel did an amazing job with the database tests. Unfortunately quite a number of tests did not work after core refactoring.
Especially the possibility to create a plugin with a simple call does not work since the data for plugin is read within the core and not passed upon creation any more.

Example Init function of the current SamplePlugin:

def __init__(self, sh):

Old Plugins used to have an init function like:

def __init__(self, smarthome, time_ga=None, date_ga=None, send_time=False, busmonitor=False, host='127.0.0.1', port=6720, readonly=False, instance='default', enable_stats = True):
@bmxp bmxp added core Issue relates to the core of SmartomeNG help wanted plugins Issue relates to a plugin labels Sep 26, 2020
@bmxp bmxp added this to the Version 1.8 milestone Sep 26, 2020
@msinn msinn modified the milestones: Version 1.8, Version 1.9 Dec 24, 2020
@bmxp bmxp modified the milestones: Version 1.9, Version 1.10 Apr 30, 2022
@Morg42
Copy link
Member

Morg42 commented Oct 30, 2023

The "single-call" issue can be circumvented by setting the plugins self._parameters dict before the call containing all needed data.

If necessary, the original dict can be saved beforehand and restored afterwards...

@Morg42 Morg42 removed this from the Version 1.10 milestone Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Issue relates to the core of SmartomeNG help wanted plugins Issue relates to a plugin
Projects
None yet
Development

No branches or pull requests

3 participants