mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-30 01:41:43 +00:00
Rewrite all import statements, patch() targets, sys.modules keys, importlib.import_module() strings, and subprocess -m references to use hermes_agent.* paths. Strip sys.path.insert hacks from production code (rely on editable install). Update COMPONENT_PREFIXES for logger filtering. Fix 3 hardcoded getLogger() calls to use __name__. Update transport and tool registry discovery paths. Update plugin module path strings. Add legacy process-name patterns for gateway PID detection. Add main() to skills_sync for console_script entry point. Fix _get_bundled_dir() path traversal after move. Part of #14182, #14183
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
"""Test that skills subparser doesn't conflict (regression test for #898)."""
|
|
|
|
import argparse
|
|
|
|
|
|
def test_no_duplicate_skills_subparser():
|
|
"""Ensure 'skills' subparser is only registered once to avoid Python 3.11+ crash.
|
|
|
|
Python 3.11 changed argparse to raise an exception on duplicate subparser
|
|
names instead of silently overwriting (see CPython #94331).
|
|
|
|
This test will fail with:
|
|
argparse.ArgumentError: argument command: conflicting subparser: skills
|
|
|
|
if the duplicate 'skills' registration is reintroduced.
|
|
"""
|
|
# Force fresh import of the module where parser is constructed
|
|
# If there are duplicate 'skills' subparsers, this import will raise
|
|
# argparse.ArgumentError at module load time
|
|
import importlib
|
|
import sys
|
|
|
|
# Remove cached module if present
|
|
if 'hermes_agent.cli.main' in sys.modules:
|
|
del sys.modules['hermes_agent.cli.main']
|
|
|
|
try:
|
|
import hermes_agent.cli.main # noqa: F401
|
|
except argparse.ArgumentError as e:
|
|
if "conflicting subparser" in str(e):
|
|
raise AssertionError(
|
|
f"Duplicate subparser detected: {e}. "
|
|
"See issue #898 for details."
|
|
) from e
|
|
raise
|