Skip to content

remove diagnostic timestamp test overlaping another#965

Closed
nicolasaunai wants to merge 1 commit intoPHAREHUB:masterfrom
nicolasaunai:remove_timestamp_diagtest
Closed

remove diagnostic timestamp test overlaping another#965
nicolasaunai wants to merge 1 commit intoPHAREHUB:masterfrom
nicolasaunai:remove_timestamp_diagtest

Conversation

@nicolasaunai
Copy link
Member

Maybe it was useful for something... but I can't tell what just by looking at it.
It's going further in time that the second test but it's testing more or less the same thing.
If really needed we can probably make the second test run further too (?) but the reason needs to be explained I think.

@coderabbitai
Copy link

coderabbitai bot commented Feb 21, 2025

📝 Walkthrough

Walkthrough

This pull request removes an unnecessary test method and refines an existing one in the diagnostics test suite. The removed method was responsible for checking diagnostic timestamp dumps, while the retained method now includes a clarifying docstring and updated variable names. The changes improve the clarity of the test logic for dumping diagnostic timestamps, particularly for the "B" quantity, by altering loop variables and the logic used for generating timestamps.

Changes

File Summary of Changes
tests/simulator/test_diagnostic_timestamps.py - Removed: test_dump_diags_timestamps method.
- Modified: test_hierarchy_timestamp_cadence method: added descriptive docstring, renamed variables from trailing/i to skip_init/diag_cadence, and updated timestamp generation and assertion logic accordingly.

Sequence Diagram(s)

sequenceDiagram
    participant T as Test Method
    participant D as Diagnostic Engine
    participant H as HDF5 Handler

    T->>D: Initialize diagnostic setup (with refinement boxes)
    T->>D: Begin loop using 'skip_init' and 'diag_cadence'
    D-->>T: Generate diagnostic timestamp based on cadence
    T->>H: Format and compare generated timestamp
    T->>T: Assert equality with expected timestamp output
Loading

Possibly related PRs

  • fix functional tests #867: Enhancements related to diagnostic timestamp handling in the same test file, specifically involving changes with the h5_time_grp_key import and associated functionality.

Suggested reviewers

  • PhilipDeegan
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f398041 and 01739ee.

📒 Files selected for processing (1)
  • tests/simulator/test_diagnostic_timestamps.py (2 hunks)
🧰 Additional context used
🪛 Ruff (0.8.2)
tests/simulator/test_diagnostic_timestamps.py

140-140: Undefined name i

(F821)

⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: build (macos-latest)
  • GitHub Check: Analyze (cpp)
  • GitHub Check: build (macos-14)
  • GitHub Check: Analyze (python)
  • GitHub Check: build (macos-13)
  • GitHub Check: build (ubuntu-latest)
🔇 Additional comments (2)
tests/simulator/test_diagnostic_timestamps.py (2)

108-121: LGTM! Clear and comprehensive docstring.

The docstring effectively explains the test's purpose, conditions, and verification steps.


129-130: LGTM! More descriptive variable names.

The variable renaming from trailing to skip_init and i to diag_cadence improves code readability by better reflecting their purpose.

setup_model(10)

timestamps = np.arange(0, final_time, time_step * i)[trailing:]
timestamps = np.arange(0, final_time, time_step * i)[skip_init:]
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix undefined variable error.

The variable i is undefined. It should be diag_cadence to match the loop variable name.

Apply this diff to fix the undefined variable:

-                timestamps = np.arange(0, final_time, time_step * i)[skip_init:]
+                timestamps = np.arange(0, final_time, time_step * diag_cadence)[skip_init:]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
timestamps = np.arange(0, final_time, time_step * i)[skip_init:]
timestamps = np.arange(0, final_time, time_step * diag_cadence)[skip_init:]
🧰 Tools
🪛 Ruff (0.8.2)

140-140: Undefined name i

(F821)

@nicolasaunai
Copy link
Member Author

This test was made to run for a long time to make sure we do not have rounding errors in the way the time is set in PHARE. Before, time was incrementally increase by dt, leading to rounding errors, leading to key errors while reading diags. Now with the ConstantTimeStamper, we iterate the time INDEX and get the current time increment from start time, which removes the rounding error.

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