Skip to content

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Oct 13, 2025

Description

LCORE-740: type hints in tests

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement

Related Tickets & Documents

  • Related Issue #LCORE-740

Summary by CodeRabbit

  • Tests
    • Added explicit return type annotations to multiple unit tests, including async tests, to improve clarity and consistency.
    • Standardized test function signatures across authentication and utility test suites.
    • No changes to application behavior; this update solely enhances test readability and maintainability.
    • Helps ensure stricter type checking and more reliable test tooling integration.
    • Improves developer experience without impacting end-user functionality.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 13, 2025

Walkthrough

Adds explicit None return type annotations to test function definitions in two test modules: authentication tests and MCP headers utility tests. No logic or control-flow changes; only function signatures updated. Async tests retain async with added -> None annotations.

Changes

Cohort / File(s) Summary of Changes
Authentication tests
tests/unit/authentication/test_auth.py
Added explicit return type hints (-> None) to three test functions; no behavioral changes.
MCP headers tests
tests/unit/utils/test_mcp_headers.py
Added explicit return type hints (-> None) to all test functions, including async tests; no behavioral changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

A nibble of None on each test I see,
Type hints sprinkled like clover for me.
Async or not, the tails align—
Hop, hop, signatures look fine.
In burrows of CI, I gleefully run,
Green-lit paths under autumn sun. 🌿🐇

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly reflects the main change by indicating addition of type hints in tests and references the related issue ticket.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a47c98a and 8e11157.

📒 Files selected for processing (2)
  • tests/unit/authentication/test_auth.py (1 hunks)
  • tests/unit/utils/test_mcp_headers.py (14 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.py: All modules start with descriptive module-level docstrings explaining purpose
Use logger = logging.getLogger(name) for module logging after import logging
Define type aliases at module level for clarity
All functions require docstrings with brief descriptions
Provide complete type annotations for all function parameters and return types
Use typing_extensions.Self in model validators where appropriate
Use modern union syntax (str | int) and Optional[T] or T | None consistently
Function names use snake_case with descriptive, action-oriented prefixes (get_, validate_, check_)
Avoid in-place parameter modification; return new data structures instead of mutating arguments
Use appropriate logging levels: debug, info, warning, error with clear messages
All classes require descriptive docstrings explaining purpose
Class names use PascalCase with conventional suffixes (Configuration, Error/Exception, Resolver, Interface)
Abstract base classes should use abc.ABC and @AbstractMethod for interfaces
Provide complete type annotations for all class attributes
Follow Google Python docstring style for modules, classes, and functions, including Args, Returns, Raises, Attributes sections as needed

Files:

  • tests/unit/authentication/test_auth.py
  • tests/unit/utils/test_mcp_headers.py
tests/{unit,integration}/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

tests/{unit,integration}/**/*.py: Use pytest for all unit and integration tests
Do not use unittest in tests; pytest is the standard

Files:

  • tests/unit/authentication/test_auth.py
  • tests/unit/utils/test_mcp_headers.py
tests/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

tests/**/*.py: Use pytest-mock to create AsyncMock objects for async interactions in tests
Use the shared auth mock constant: MOCK_AUTH = ("mock_user_id", "mock_username", False, "mock_token") in tests

Files:

  • tests/unit/authentication/test_auth.py
  • tests/unit/utils/test_mcp_headers.py
🧬 Code graph analysis (1)
tests/unit/authentication/test_auth.py (4)
src/configuration.py (2)
  • configuration (65-69)
  • authentication_configuration (100-105)
src/authentication/__init__.py (1)
  • get_auth_dependency (14-52)
src/authentication/noop.py (1)
  • NoopAuthDependency (17-42)
src/authentication/noop_with_token.py (1)
  • NoopWithTokenAuthDependency (26-55)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build-pr
  • GitHub Check: e2e_tests (ci)
  • GitHub Check: e2e_tests (azure)
🔇 Additional comments (2)
tests/unit/authentication/test_auth.py (1)

9-9: LGTM! Type hints properly added.

The explicit -> None return type annotations for all three test functions align with the coding guidelines requiring complete type annotations for all functions.

As per coding guidelines.

Also applies to: 17-17, 25-25

tests/unit/utils/test_mcp_headers.py (1)

11-11: LGTM! Type hints properly added to all test functions.

The explicit -> None return type annotations have been consistently added to all 14 test functions (both synchronous and asynchronous), aligning with the coding guidelines requiring complete type annotations for all functions.

As per coding guidelines.

Also applies to: 21-21, 32-32, 44-44, 62-62, 73-73, 84-84, 96-96, 108-108, 120-120, 133-133, 152-152, 164-164, 176-176


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tisnik tisnik merged commit ee1b00b into lightspeed-core:main Oct 13, 2025
18 of 20 checks passed
asimurka pushed a commit to asimurka/lightspeed-stack that referenced this pull request Oct 13, 2025
…ts-in-tests

LCORE-740: type hints in tests
asimurka pushed a commit to asimurka/lightspeed-stack that referenced this pull request Oct 13, 2025
…ts-in-tests

LCORE-740: type hints in tests
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.

1 participant