Problem Description
The repository currently has zero unit tests and no automated CI workflow. Even though detector.py checks for PYTEST_CURRENT_TEST, there are no test files in the codebase to prevent regressions when PRs are submitted.
Proposed Solution
- Add
pytest and pytest-mock to dev dependencies.
- Create
tests/ directory with test cases for:
test_cli.py: Command line flags (--version, --help, non-existent path, output folder).
test_analyzer.py: AST parsing, comment counting (Python docstrings, C-style comments), function and class counting.
test_utils.py: list_source_files(), .insightignore filtering, supported file types.
test_reporter.py: Markdown file creation, metric formatting, summary generation.
test_detector.py: Mocked Gemini API responses and score parsing.
- Setup
.github/workflows/ci.yml running pytest across Python 3.9, 3.10, 3.11, 3.12, 3.13 on Ubuntu, macOS, and Windows.
Problem Description
The repository currently has zero unit tests and no automated CI workflow. Even though
detector.pychecks forPYTEST_CURRENT_TEST, there are no test files in the codebase to prevent regressions when PRs are submitted.Proposed Solution
pytestandpytest-mockto dev dependencies.tests/directory with test cases for:test_cli.py: Command line flags (--version,--help, non-existent path, output folder).test_analyzer.py: AST parsing, comment counting (Python docstrings, C-style comments), function and class counting.test_utils.py:list_source_files(),.insightignorefiltering, supported file types.test_reporter.py: Markdown file creation, metric formatting, summary generation.test_detector.py: Mocked Gemini API responses and score parsing..github/workflows/ci.ymlrunning pytest across Python 3.9, 3.10, 3.11, 3.12, 3.13 on Ubuntu, macOS, and Windows.