Skip to content

test: exhaustive pytest coverage#53

Open
deacon-mp wants to merge 1 commit intomasterfrom
test/exhaustive-pytest-coverage
Open

test: exhaustive pytest coverage#53
deacon-mp wants to merge 1 commit intomasterfrom
test/exhaustive-pytest-coverage

Conversation

@deacon-mp
Copy link
Copy Markdown
Contributor

Summary

  • Expands pytest test suite to cover all emu plugin modules
  • Tests all parsers, requirements, planner, service, and GUI
  • Builds on existing test infrastructure (tox.ini + CI workflow)

Test plan

  • Run pytest tests/ -v to verify all tests pass

🤖 Generated with Claude Code

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the pytest test suite for the emu plugin, adding tests for parsers, requirements, planner, service, GUI, and the hook module. It introduces a conftest.py that stubs out caldera framework dependencies so tests can run in isolation.

Changes:

  • Added tests/conftest.py with stub classes for caldera framework objects and sys.modules patching
  • Added new test files (test_requirements.py, test_hook.py, test_emu_gui.py) and expanded existing ones (test_emu_svc.py, test_vssadmin_shadow_parser.py, test_group_filtered_planner.py)
  • Added pytest.ini configuration and plugins/emu/conf/default.yml

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/conftest.py Shared stubs and fixtures for running tests without caldera
tests/test_requirements.py Tests for check_registered and check_lightneuron_registered requirements
tests/test_hook.py Tests for hook.py enable function and module attributes
tests/test_emu_gui.py Tests for EmuGUI construction and splash handler
tests/test_emu_svc.py Expanded EmuService tests covering ingestion, payloads, cloning, etc.
tests/test_vssadmin_shadow_parser.py Additional parser and parse method tests
tests/test_group_filtered_planner.py Refactored planner tests using stubs instead of real Link objects
pytest.ini pytest configuration with asyncio_mode=auto
plugins/emu/conf/default.yml Default config file for emu plugin

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +42 to +49
# Provide minimal config
conf_dir = os.path.join('plugins', 'emu', 'conf')
os.makedirs(conf_dir, exist_ok=True)
conf_path = os.path.join(conf_dir, 'default.yml')
if not os.path.exists(conf_path):
with open(conf_path, 'w') as f:
yaml.dump({'evals_c2_host': '127.0.0.1', 'evals_c2_port': 8888}, f)

Comment on lines +174 to +177
# Also make the plugin available as plugins.emu
_plugins_emu_mod = type(sys)('plugins.emu')
_plugins_emu_mod.__path__ = [_repo_root]
sys.modules.setdefault('plugins.emu', _plugins_emu_mod)
Comment on lines +52 to +53
# The underlying function or its wrapper should be a coroutine function
assert asyncio.iscoroutinefunction(gui.splash) or callable(gui.splash)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants