Skip to content

Conversation

PaulFarault
Copy link
Contributor

This pull request introduces significant refactoring and improvements to the test suite for the TDP CLI application. The changes focus on modularizing the test setup, enhancing reusability, and improving the clarity of test cases. Key updates include the removal of redundant code, the introduction of helper methods, and the addition of new integration tests for the CLI.

Refactoring and modularization of test fixtures:

  • tests/conftest.py: Removed unused imports and redundant database-related fixtures (db_engine, create_session, etc.). Introduced modular helper functions (init_dag_directory, init_playbooks_directory, init_default_vars_directory) for creating test collections. Simplified the generate_collection_at_path function to use these helpers. [1] [2] [3] [4]

  • tests/e2e/conftest.py: Replaced the TDPInitArgs class with a more flexible CollectionPath class, which provides methods for initializing directories. Added a collection_path_factory fixture for creating multiple collections in tests. Simplified the tdp fixture to invoke CLI commands with a runner.

  • Updated existing tests cases to use the new fixtures.

Enhanced CLI integration tests:

  • tests/e2e/test_tdp.py: Added new tests to validate CLI functionality, including help messages, command routing, and global options. These tests ensure consistent behavior across commands and subcommands.
  • Create more complete tests for the tdp init command in tests/e2e/test_tdp_init.py.

These changes improve the maintainability and scalability of the test suite, making it easier to add new tests and adapt to future changes in the codebase.

Agreements

@PaulFarault PaulFarault requested a review from rpignolet July 24, 2025 13:59
@PaulFarault PaulFarault self-assigned this Jul 24, 2025
def db_dsn(
request: pytest.FixtureRequest, tmp_path: Path
) -> Generator[str, None, None]:
def db_dsn(request, tmp_path) -> Generator[str, None, None]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove types for parameters ?

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.

2 participants