mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-09-12 22:25:49 -04:00
Refactor plugin paths in scripts and tests to ensure consistent directory structure
This commit is contained in:
1 parent
9e38cfd8b4
commit
a06dc259a8
6 files changed
+10
-9
No files matched your search
Vendored
+1
-2
@@ -35,8 +35,7 @@
|
||||
"chat.tools.terminal.autoApprove": {
|
||||
"test": true,
|
||||
"git check-ignore": true,
|
||||
"mkdir": true,
|
||||
"cp": true
|
||||
"mkdir": true
|
||||
},
|
||||
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in new issue
Block a user