Skip to content

Improvement: Add unit tests for cr_checker using pytest and Bazel #177

Closed as not planned

Description

@nradakovic

Background

The cr_checker tool currently lacks unit tests, which compromises its reliability and increases the risk of regressions during updates. Unit testing is essential for validating functionality, identifying issues early, and maintaining a stable tool. Additionally, integrating pytest with the Bazel build system aligns with our existing workflows and ensures consistent test execution across environments.

Objectives

  • Write comprehensive unit tests for cr_checker using pytest to achieve robust coverage.
  • Integrate pytest into the Bazel build system to standardize testing and enable automation in CI/CD workflows.

Acceptance Criteria

  • A suite of unit tests is implemented for cr_checker, covering critical functionality and edge cases.
  • pytest is successfully integrated with Bazel, allowing tests to run seamlessly through Bazel commands.
  • Tests are runnable both locally and in the CI pipeline without additional manual steps.
  • Documentation is provided for running and maintaining the tests.

Proposed Steps

  1. Analyze Tool Functionality:

    • Review the codebase of cr_checker to identify the key components and their functionalities.
    • Outline critical paths and edge cases that require testing.
  2. Develop Unit Tests:

    • Use pytest to write tests for individual functions and modules.
    • Ensure high test coverage by addressing all major use cases and failure scenarios.
  3. Integrate Pytest with Bazel:

    • Create or modify Bazel rules to include pytest-based testing.
    • Ensure pytest is correctly configured to work within the Bazel environment.
  4. Verify and Validate:

    • Run tests locally via Bazel to confirm they execute successfully.
    • Integrate the tests into the CI pipeline and verify the workflow.
  5. Document the Process:

    • Provide clear instructions for running the tests with Bazel.
    • Include guidelines for writing and adding new tests in the future.

Resources

pytest documentation
py_test Bazel rules

Activity

  1. self-assigned this
    on Jan 16, 2025
  2. AlexanderLanin commented on Jan 17, 2025

    @AlexanderLanin
    Member

    Note for 3.: this seems to overlap with #159

  3. nradakovic commented on Jan 17, 2025

    @nradakovic
    MemberAuthor

    Note for 3.: this seems to overlap with #159

    In aspect of integrating pytest in Bazel as framework, yes, but we need to write pytests for the tool and make sure they are tested with Bazel both locally and on CI.

    I see there is already PR providing framework, so we will wait until the PR is not merged.

  4. moved this from Todo to In Progress in INF - Infrastructure Communityon Jan 21, 2025
  5. moved this to Backlog in S-CORE Roadmapon Apr 9, 2025
  6. moved this from In Progress to Todo in INF - Infrastructure Communityon Apr 14, 2025
  7. AlexanderLanin commented on Apr 28, 2025

    @AlexanderLanin
    Member

    The same is true for every single tool we have. I'll close this for now.

  8. removed theissue type on Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions