From 72d046e780dd1ace770b7489d28e55aac62688bd Mon Sep 17 00:00:00 2001 From: kmpepper Date: Mon, 9 Feb 2026 20:21:23 +0000 Subject: [PATCH] Edit core code to launch / run unit tests when magma plugin is not present --- app/api/rest_api.py | 4 +++- tests/web_server/test_core_endpoints.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/api/rest_api.py b/app/api/rest_api.py index 1de5e1150..a681a2d89 100644 --- a/app/api/rest_api.py +++ b/app/api/rest_api.py @@ -29,7 +29,9 @@ def __init__(self, services): asyncio.get_event_loop().create_task(AdvancedPack(services).enable()) async def enable(self): - self.app_svc.application.router.add_static('/assets', 'plugins/magma/dist/assets/', append_version=True) + # check if plugin path is present + if os.path.exists("plugins/magma/dist/assets") and (len(os.listdir("plugins/magma/dist/assets")) > 0): + self.app_svc.application.router.add_static('/assets', 'plugins/magma/dist/assets/', append_version=True) # TODO: only serve static files in legacy plugin mode self.app_svc.application.router.add_static('/gui', 'static/', append_version=True) # unauthorized GUI endpoints diff --git a/tests/web_server/test_core_endpoints.py b/tests/web_server/test_core_endpoints.py index 33798dae8..6284d696f 100644 --- a/tests/web_server/test_core_endpoints.py +++ b/tests/web_server/test_core_endpoints.py @@ -63,6 +63,8 @@ async def sample_agent(aiohttp_client): async def test_home(aiohttp_client): + if not (len(os.listdir("plugins/magma/dist/assets")) > 0): + pytest.xfail("Magma plugin not present, expecting failure") resp = await aiohttp_client.get('/') assert resp.status == HTTPStatus.OK assert resp.content_type == 'text/html'