Skip to content

Conversation

@glados-verma
Copy link
Collaborator

@glados-verma glados-verma commented May 21, 2025

This change is Reviewable

google-labs-jules bot and others added 5 commits May 21, 2025 01:25
….py`

and a shared utility function for tests.

Summary of changes:
- Created `test/examples/test_measurements.py` with a `TestMeasurements`
  class to verify the output of `examples/measurements.py`.
  - Test checks for DUT ID, overall outcome (FAIL, as expected due to
    `inline_phase`), total number of phases (7), and specific
    measurement values and outcomes for `hello_phase`, `measure_seconds`,
    `inline_phase`, and `multdim_measurements`.
  - Added assertions for `validated_measurement` as per your feedback.
  - Resolved test failures by ensuring `pandas` is available and by
    correctly identifying phase names and counts.

- Created `test/examples/test_utils.py` containing a helper function
  `get_phase_by_name(test_case, phases_data, phase_name)`.
  - This function retrieves a phase dictionary by its name from the
    test output data, making tests more robust to phase order changes.
  - It calls `test_case.fail()` if the phase is not found.

- Refactored `test/examples/test_measurements.py` to use the
  `get_phase_by_name` utility.

- Refactored `test/examples/test_hello_world.py` to use the
  `get_phase_by_name` utility.
  - Corrected the phase name used in this test to "hello_world".

The tests in `test_measurements.py` are confirmed to pass. The final
run of `test_hello_world.py` after its last correction was pending
but is expected to pass.
…rent working directory, since it's messy to have output files show up in the source tree
@copybara-service copybara-service bot merged commit b3a56ee into google:master May 21, 2025
10 checks passed
@glados-verma glados-verma deleted the feat-test-measurements-and-helper branch May 21, 2025 21:15
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