Skip to content

Conversation

@filipchristiansen
Copy link
Contributor

Overview

This PR centralizes key improvements in the application’s structure and testing approach:

  1. Lifespan & Cleanup in utils.py

    • Moved the repository cleanup task, rate_limit_exception_handler, and lifespan from main.py into a new utils.py module.
  2. Unified Template Usage

    • Removed repeated Jinja2Templates instantiations, replacing them with the shared TEMPLATES from config.py.
    • Updated routers, the main app, and query processors to reference TEMPLATES directly for more consistent template loading.
  3. Test Enhancements

    • Adopted a “Given/When/Then” style for test docstrings, clarifying each test’s scenario and outcome.
    • Parametrized certain tests (e.g., branch vs. commit distinction) to reduce duplication in query_parser.
    • Used pytest.warns to capture warnings explicitly in test_parse_repo_source_with_failed_git_command.

- Move background tasks and rate-limit handler into utils.py
- Reference TEMPLATES from config instead of inline Jinja2Templates
- Adopt Given/When/Then docstrings for test clarity
- Parametrize some tests and consolidate code across query_parser tests
- Add pytest.warns context handler to test_parse_repo_source_with_failed_git_command
@filipchristiansen filipchristiansen force-pushed the refactor/code_cleanup_utils_and_tests branch from a2ae334 to 63b5f23 Compare January 19, 2025 11:04
@cyclotruc cyclotruc merged commit 58dbe2c into main Jan 23, 2025
8 checks passed
@cyclotruc cyclotruc deleted the refactor/code_cleanup_utils_and_tests branch January 23, 2025 01:46
FOLKS-Tech pushed a commit to FOLKS-Tech/gitingest that referenced this pull request Sep 5, 2025
…ramp-labs#141)

* Refactor code for lifespan, template usage, and improved tests

- Move background tasks and rate-limit handler into utils.py
- Reference TEMPLATES from config instead of inline Jinja2Templates
- Adopt Given/When/Then docstrings for test clarity
- Parametrize some tests and consolidate code across query_parser tests
- Add pytest.warns context handler to test_parse_repo_source_with_failed_git_command
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.

3 participants