From a06dc259a826a67fbbfff6c9ef792e322bb156b5 Mon Sep 17 00:00:00 2001 From: "Jokob @NetAlertX" <96159884+jokob-sk@users.noreply.github.com> Date: Mon, 10 Aug 2026 03:51:23 +0000 Subject: [PATCH] Refactor plugin paths in scripts and tests to ensure consistent directory structure --- .vscode/settings.json | 3 +-- docs/PLUGINS_DEV_QUICK_START.md | 2 +- server/plugins/kea_api/script.py | 2 +- test/plugins/test_fritzbox.py | 5 +++-- test/plugins/test_rest_import.py | 5 +++-- test/test_device_atomicity.py | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 5350a958..63f1fc56 100755 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -35,8 +35,7 @@ "chat.tools.terminal.autoApprove": { "test": true, "git check-ignore": true, - "mkdir": true, - "cp": true + "mkdir": true }, } \ No newline at end of file diff --git a/docs/PLUGINS_DEV_QUICK_START.md b/docs/PLUGINS_DEV_QUICK_START.md index c5d5dfc7..1998e31c 100644 --- a/docs/PLUGINS_DEV_QUICK_START.md +++ b/docs/PLUGINS_DEV_QUICK_START.md @@ -47,7 +47,7 @@ Edit `my_plugin/script.py` and implement your data collection logic: import sys import os sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../server')) -sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../plugins')) +sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../server/plugins')) from plugin_helper import Plugin_Objects, mylog from helper import get_setting_value diff --git a/server/plugins/kea_api/script.py b/server/plugins/kea_api/script.py index 2f418d9c..dd032eda 100644 --- a/server/plugins/kea_api/script.py +++ b/server/plugins/kea_api/script.py @@ -4,7 +4,7 @@ import sys import requests sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../server')) -sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../plugins')) +sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../server/plugins')) from plugin_helper import Plugin_Objects, mylog, is_mac # noqa: E402 [flake8 lint suppression] from helper import get_setting_value # noqa: E402 [flake8 lint suppression] diff --git a/test/plugins/test_fritzbox.py b/test/plugins/test_fritzbox.py index cb7ab40e..b81e843b 100644 --- a/test/plugins/test_fritzbox.py +++ b/test/plugins/test_fritzbox.py @@ -21,9 +21,10 @@ import pytest _ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")) _SERVER = os.path.join(_ROOT, "server") -_PLUGIN_DIR = os.path.join(_ROOT, "front", "plugins", "fritzbox") +_PLUGINS = os.path.join(_ROOT, "server", "plugins") +_PLUGIN_DIR = os.path.join(_ROOT, "server", "plugins", "fritzbox") -for _p in [_ROOT, _SERVER, _PLUGIN_DIR]: +for _p in [_ROOT, _SERVER, _PLUGINS, _PLUGIN_DIR]: if _p not in sys.path: sys.path.insert(0, _p) diff --git a/test/plugins/test_rest_import.py b/test/plugins/test_rest_import.py index eeef374a..fcc3c59a 100644 --- a/test/plugins/test_rest_import.py +++ b/test/plugins/test_rest_import.py @@ -18,9 +18,10 @@ import pytest _ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')) _SERVER = os.path.join(_ROOT, 'server') -_PLUGIN_DIR = os.path.join(_ROOT, 'front', 'plugins', 'rest_import') +_PLUGINS = os.path.join(_ROOT, 'server', 'plugins') +_PLUGIN_DIR = os.path.join(_ROOT, 'server', 'plugins', 'rest_import') -for _p in [_ROOT, _SERVER, _PLUGIN_DIR, os.path.join(_ROOT, 'front', 'plugins')]: +for _p in [_ROOT, _SERVER, _PLUGINS, _PLUGIN_DIR]: if _p not in sys.path: sys.path.insert(0, _p) diff --git a/test/test_device_atomicity.py b/test/test_device_atomicity.py index 83516fe6..26c8d332 100644 --- a/test/test_device_atomicity.py +++ b/test/test_device_atomicity.py @@ -17,7 +17,7 @@ from unittest.mock import patch # Add server and plugins to path sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'server')) -sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'front', 'plugins')) +sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'server', 'plugins')) from models.device_instance import DeviceInstance # noqa: E402 [flake8 lint suppression] from plugin_helper import normalize_mac # noqa: E402 [flake8 lint suppression]