From 7184c43b08e453e5a1bfe1ffedf727641b9570b0 Mon Sep 17 00:00:00 2001 From: user Date: Sun, 15 Feb 2026 06:17:11 +0100 Subject: [PATCH] fix: resolve test_username.py import for plugins/ directory Load plugins.username via importlib.util.spec_from_file_location since plugins/ is not a Python package on sys.path. Co-Authored-By: Claude Opus 4.6 --- tests/test_username.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/test_username.py b/tests/test_username.py index d876b43..cbe1ca7 100644 --- a/tests/test_username.py +++ b/tests/test_username.py @@ -1,6 +1,18 @@ """Tests for the username enumeration plugin.""" -from plugins.username import ( +import importlib.util +import sys +from pathlib import Path + +# plugins/ is not a Python package -- load the module from file path +_spec = importlib.util.spec_from_file_location( + "plugins.username", Path(__file__).resolve().parent.parent / "plugins" / "username.py", +) +_mod = importlib.util.module_from_spec(_spec) +sys.modules[_spec.name] = _mod +_spec.loader.exec_module(_mod) + +from plugins.username import ( # noqa: E402 _BY_CATEGORY, _BY_NAME, _SERVICES,