Skip to content

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Oct 12, 2025

Description

LCORE-740: more 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 across integration and unit tests, aligning with typing conventions and standardizing function signatures.
    • Enhances static analysis and IDE hints, improving readability and consistency of the test suite.
    • No changes to runtime behavior or product functionality; test logic and outcomes remain the same.
    • This is a non-functional update focused on test code quality.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 12, 2025

Walkthrough

Added explicit return type annotations to several test functions across integration and unit test files. No logic, assertions, or control flow were modified.

Changes

Cohort / File(s) Summary
Test type hint updates
tests/integration/test_version.py, tests/unit/test_lightspeed_stack.py, tests/unit/utils/test_suid.py
Added return type annotations: functions now explicitly return str or None as appropriate; no behavioral changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

I twitch my ears at types so fine,
A hint of None, a string in line.
Tests still hop the very same way,
Just clearer paths for tools to weigh.
Tap-tap paws, green lights shine—
Typed and tidy, burrowed design! 🐇✨

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 accurately and concisely describes the primary change—adding additional type hints to tests—while including the relevant issue identifier, and avoids unnecessary detail or vagueness.
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 1971239 and e0460d9.

📒 Files selected for processing (3)
  • tests/integration/test_version.py (2 hunks)
  • tests/unit/test_lightspeed_stack.py (1 hunks)
  • tests/unit/utils/test_suid.py (1 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/utils/test_suid.py
  • tests/integration/test_version.py
  • tests/unit/test_lightspeed_stack.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/utils/test_suid.py
  • tests/integration/test_version.py
  • tests/unit/test_lightspeed_stack.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/utils/test_suid.py
  • tests/integration/test_version.py
  • tests/unit/test_lightspeed_stack.py
🧬 Code graph analysis (1)
tests/unit/utils/test_suid.py (1)
src/utils/suid.py (2)
  • get_suid (6-16)
  • check_suid (19-38)
⏰ 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 (azure)
  • GitHub Check: e2e_tests (ci)
🔇 Additional comments (4)
tests/unit/test_lightspeed_stack.py (1)

6-6: LGTM! Type hint is correct.

The -> None return type annotation is accurate for this test function and aligns with the coding guidelines requiring complete type annotations.

tests/integration/test_version.py (2)

8-8: LGTM! Type hint is correct.

The -> str return type annotation accurately reflects that this helper function returns a string (the decoded and stripped stdout from line 18).


21-21: LGTM! Type hint is correct.

The -> None return type annotation is accurate for this test function and aligns with the coding guidelines requiring complete type annotations.

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

9-9: LGTM! Type hints are correct.

All three -> None return type annotations are accurate for these test methods and align with the coding guidelines requiring complete type annotations.

Also applies to: 15-15, 22-22


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 cbaf8c8 into lightspeed-core:main Oct 12, 2025
18 of 20 checks passed
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