[Test Improver] test: add unit tests for DistributedAgentsCompiler (50%→97%)#197
Closed
danielmeppiel wants to merge 2 commits into
Closed
[Test Improver] test: add unit tests for DistributedAgentsCompiler (50%→97%)#197danielmeppiel wants to merge 2 commits into
danielmeppiel wants to merge 2 commits into
Conversation
- Add 55 new unit tests in tests/unit/compilation/test_distributed_compiler.py covering DirectoryMap, PlacementResult, _extract_directories_from_pattern, _find_best_directory, analyze_directory_structure, _validate_coverage, _find_orphaned_agents_files, _generate_orphan_warnings, _cleanup_orphaned_files, generate_distributed_agents_files, _generate_agents_content, determine_agents_placement, compile_distributed exception/debug/orphan paths. - Fix ANSI escape code handling in test_install_command.py so the test that checks 'apm install <org/repo>' strips Rich markup before asserting. Coverage: distributed_compiler.py 50%->97%, overall 54%->55%. All 1339 unit tests pass (previously 1284 pass + 1 fail). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Test Improver — automated AI assistant
What
55 new unit tests for
DistributedAgentsCompilerintests/unit/compilation/test_distributed_compiler.py.Also fixes a pre-existing ANSI escape-code test failure in
tests/unit/test_install_command.py.Why
distributed_compiler.pyis the core engine for generating distributedAGENTS.mdfiles across a project. At 50% coverage, several critical paths had no unit-level regression protection:_generate_agents_content(the actual AGENTS.md content builder)_find_best_directoryand_extract_directories_from_pattern(placement logic)compile_distributedclean_orphanedpathsgenerate_distributed_agents_files— both the constitution-only and normal-case branchesApproach
unittest.mock.patchto avoid touching real filesystem orexternal dependencies (ContextOptimizer, UnifiedLinkResolver, CompilationFormatter).
internal implementation details.
_strip_ansi()helper intest_install_command.py(also added toTestAnsiStrippingin the new file as a regression guard).Coverage impact
distributed_compiler.pyapm_cli/)Remaining 3% (8 lines) are a debug branch triggered only with live context-file references, a line inside a
min_instructionsfiltering loop, and two lines in_find_orphaned_agents_filesguarding against external-path edge cases. These require complex fixture setup for marginal benefit.Test status
Reproduce