Skip to content

test: add unit testings for core functions of sanity module#223

Merged
ktro2828 merged 1 commit into
mainfrom
test/sanity
Nov 14, 2025
Merged

test: add unit testings for core functions of sanity module#223
ktro2828 merged 1 commit into
mainfrom
test/sanity

Conversation

@ktro2828

Copy link
Copy Markdown
Collaborator

What

This pull request adds a set of new tests for the sanity module, improving coverage for key components such as context management, rule group mapping, result evaluation, and the main sanity check function. These tests help ensure that the core logic for dataset structure validation and reporting behaves as expected under different scenarios.

New test coverage and validation:

Sanity context and data discovery:

  • Added test_sanity_context to verify that SanityContext.from_path correctly identifies data root, dataset ID, and subdirectories, and maps schema files as expected.

Rule group mapping:

  • Added test_rule_group_to_group to ensure that RuleGroup.to_group maps rule IDs to their correct groups and handles invalid IDs gracefully.

Result reporting and evaluation:

  • Added test_make_report and test_make_skipped to validate the creation of Report objects and their status assignment based on reasons and severity.
  • Added test_sanity_result to check the logic of SanityResult.is_passed under both strict and non-strict modes, ensuring correct pass/fail evaluation depending on report severities and statuses.

Sanity check execution:

  • Added test_sanity_check to test the end-to-end execution of the sanity_check function, verifying the overall result under different strictness settings.

Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Copilot AI review requested due to automatic review settings November 14, 2025 08:38
@github-actions github-actions Bot added the ci Continuous Integration (CI) processes and testing label Nov 14, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds comprehensive unit tests for the sanity module, covering core functionality for dataset validation including context management, rule organization, result evaluation, and sanity check execution.

Key changes:

  • Added tests for sanity context initialization and data discovery from filesystem paths
  • Added tests for rule group mapping logic and result evaluation under different strictness modes
  • Added end-to-end test for the main sanity check function

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tests/sanity/test_sanity_run.py Tests the main sanity_check function with strict and non-strict modes
tests/sanity/test_sanity_result.py Tests report creation functions and SanityResult.is_passed logic under different scenarios
tests/sanity/test_sanity_registry.py Tests RuleGroup.to_group mapping for valid and invalid rule IDs
tests/sanity/test_sanity_context.py Tests SanityContext.from_path for correct identification of data root, directories, and schema files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

github-actions Bot commented Nov 14, 2025

Copy link
Copy Markdown
Contributor

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
3900 3225 83% 50% 🟢

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: 46814ae by action🐍

@ktro2828 ktro2828 merged commit dbdc92b into main Nov 14, 2025
4 of 5 checks passed
@ktro2828 ktro2828 deleted the test/sanity branch November 14, 2025 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continuous Integration (CI) processes and testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants