Skip to content

Extend test suite with comprehensive coverage for core utility modules#10

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-9
Draft

Extend test suite with comprehensive coverage for core utility modules#10
Copilot wants to merge 2 commits intomainfrom
copilot/fix-9

Conversation

Copy link
Contributor

Copilot AI commented Jul 11, 2025

This PR significantly expands the test coverage for EasyRoutine by adding comprehensive test suites for previously untested core utility modules. The changes address the lack of test coverage identified in issue #9.

What's Added

New Test Files (89 new test methods total):

🔧 test/test_utils.py (10 tests)

  • Complete coverage of path_to_parents() and path_to_relative() functions
  • Tests for directory navigation edge cases and error conditions
  • Integration testing of path operations

📝 test/test_logger.py (20 tests)

  • Comprehensive testing of warning_once() deduplication functionality
  • Coverage of all logger configuration functions (setup_logging, enable_*, disable_logging)
  • Testing of logger level hierarchy and file/console output combinations
  • Handler management and default setup validation

📊 test/test_progress.py (37 tests)

  • Full coverage of LoggingProgress class with time and frequency-based updates
  • Testing of batch vs interactive mode detection (is_non_interactive_batch)
  • Progress bar factory function with environment detection (SLURM, PBS, etc.)
  • NoOpProgress class for disabled progress tracking
  • Main progress() function with all parameter combinations

🪝 test/test_hooks.py (22 tests)

  • Core hook utility functions: process_args_kwargs_output(), restore_same_args_kwargs_output()
  • Attention matrix operations: multiply_pattern() for ablation functionality
  • Statistical analysis: compute_statistics() with comprehensive edge cases
  • Error condition handling and boundary case testing

Key Improvements

  • 96% increase in test coverage: From ~92 to 181 total test methods
  • Lightweight design: Tests run quickly without requiring model downloads or heavy dependencies
  • Comprehensive edge case coverage: Including NaN, infinity, empty inputs, and error conditions
  • Proper isolation: Used mocking extensively to avoid external dependencies
  • Consistent patterns: Followed existing test styles and conventions

Testing Philosophy

The new tests focus on:

  • Unit-level validation of core infrastructure components
  • Edge case robustness with comprehensive boundary testing
  • Error handling to ensure graceful failure modes
  • Real-world scenarios covering practical usage patterns

These tests provide a solid foundation for the core utility infrastructure that supports EasyRoutine's interpretability functionality, making the codebase more reliable and maintainable.

Fixes #9.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: francescortu <90980154+francescortu@users.noreply.github.com>
Copilot AI changed the title [WIP] Extend test Extend test suite with comprehensive coverage for core utility modules Jul 11, 2025
Copilot AI requested a review from francescortu July 11, 2025 13:08
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.

Extend test

2 participants