Skip to content

[SC-8240] Add warning message for unregistered tests in template#316

Merged
juanmleng merged 5 commits intomainfrom
juan5508/sc-8240/add-warning-message-for-unregistered-tests-in-template
Feb 19, 2025
Merged

[SC-8240] Add warning message for unregistered tests in template#316
juanmleng merged 5 commits intomainfrom
juan5508/sc-8240/add-warning-message-for-unregistered-tests-in-template

Conversation

@juanmleng
Copy link
Contributor

Internal Notes for Reviewers

Added a new method _check_result_id_exists() that scans all sections in the documentation template to verify if a test result ID already exists anywhere in the document. This helper method:

  • Checks for duplicate test results across all sections
  • Logs an info message when a test result ID is not found in any section

External Release Notes

@juanmleng juanmleng added internal Not to be externalized in the release notes chore Chore tasks that aren't bugs or new features labels Feb 18, 2025
@juanmleng juanmleng self-assigned this Feb 18, 2025
Copy link
Contributor

@cachafla cachafla left a comment

Choose a reason for hiding this comment

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

Nice 👌

@github-actions
Copy link
Contributor

PR Summary

This pull request introduces enhancements to the TestResult class in the validmind library. The key changes include:

  1. Client Config Caching: A new class-level attribute _client_config_cache is added to cache the client configuration. The method _get_client_config is introduced to manage this cache. It reloads the API client and caches the client configuration if it is not already cached. This method also includes validation to ensure the client configuration is correctly loaded and contains the necessary attributes.

  2. Result ID Existence Check: A new method check_result_id_exist is added to verify if a result_id exists in any test block across all sections of the client configuration's documentation template. This method logs an informational message if the result_id does not exist.

  3. Integration with Existing Methods: The log method now calls check_result_id_exist to ensure the result_id is validated before proceeding with logging operations.

These changes aim to improve the efficiency and reliability of the TestResult class by reducing redundant API client reloads and ensuring the integrity of result logging.

Test Suggestions

  • Test the caching mechanism by calling _get_client_config multiple times and ensure the API client is reloaded only once.
  • Verify that check_result_id_exist correctly identifies existing and non-existing result_id values in the client configuration.
  • Test the log method to ensure it correctly integrates the check_result_id_exist method and handles both valid and invalid result_id scenarios.
  • Ensure that exceptions are raised appropriately when the client configuration is invalid or missing required attributes.

@juanmleng juanmleng merged commit c2b5323 into main Feb 19, 2025
6 checks passed
@johnwalz97 johnwalz97 deleted the juan5508/sc-8240/add-warning-message-for-unregistered-tests-in-template branch August 20, 2025 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Chore tasks that aren't bugs or new features internal Not to be externalized in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants