Skip to content

Conversation

@JamesMcClung
Copy link
Collaborator

The nbytes check was passing because it was making sure the decoded dataset had the same number of bytes as... itself. Turns out the decoded and original datasets don't actually have the same number of bytes, but their data does, so that's what it checks now.

Also, use pytest fixtures everywhere.

@codecov
Copy link

codecov bot commented Jun 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@germasch germasch requested a review from Copilot June 16, 2025 12:39
Copy link

Copilot AI left a comment

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 fixes the nbytes test by comparing the summed bytes of dataset data variables between raw and decoded datasets, and it converts tests to leverage pytest fixtures.

  • Replace direct dataset opening with pytest fixtures
  • Introduce _get_nbytes helper function for comparing dataset data sizes
  • Update several tests to use new fixtures
Comments suppressed due to low confidence (2)

tests/test_xarray_adios2.py:120

  • Consider adding a docstring for _get_nbytes to explain why summing data_vars is used instead of relying on the built-in nbytes property.
def _get_nbytes(ds: xr.Dataset) -> int:

tests/test_xarray_adios2.py:120

  • [nitpick] Consider renaming _get_nbytes to something like get_dataset_data_nbytes to clarify that it sums only the bytes of data_vars, avoiding potential confusion with the dataset's nbytes attribute.
def _get_nbytes(ds: xr.Dataset) -> int:

Copy link
Contributor

@germasch germasch left a comment

Choose a reason for hiding this comment

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

👍 -- Thanks!

I'm thinking to use Copilot PR review regularly, not sure it would have caught my original bug -- it probably would have.

@germasch germasch merged commit d091e86 into psc-code:main Jun 16, 2025
4 checks passed
@JamesMcClung JamesMcClung deleted the fix-nbytes-test branch June 16, 2025 14:44
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.

2 participants