Skip to content

Conversation

@igorniebylski
Copy link
Contributor

Since pytesty 8.4.0 tests will fail, instead of raising a warning, if they return any value other than None.

https://docs.pytest.org/en/stable/changelog.html#pytest-8-4-0-2025-06-02

Issue was identified in tests/test_convert.py tests.
To fix:

  • don't return True for dtype.char == "S" edge case
  • don't return _test_array_recode - assertion happens inside this function already, no need to return anything

@igorniebylski igorniebylski requested review from Copilot and solatis June 6, 2025 09:55
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 pytest compatibility issues by ensuring that test functions do not inadvertently return a value, which can cause test failures in pytest 8.4.0. The changes remove the non-None return in an edge-case within _test_array_recode and update the corresponding test functions.

  • Remove returning True for the dtype.char == "S" edge case.
  • Refactor test functions to call _test_array_recode without returning its value.

# should ever do this, but we do need it for input. That's why we can't test this right now, because we
# can't do it full circle.
return True
return
Copy link

Copilot AI Jun 6, 2025

Choose a reason for hiding this comment

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

Returning None here avoids sending an unintended value back to the caller, in line with pytest 8.4.0 expectations. Ensure this behavior is intentional for the edge case when dtype.char equals 'S'.

Copilot uses AI. Check for mistakes.
@conftest.override_sparsify("partial")
def test_array_recode_sparsify_partial(array_with_index_and_table):
return _test_array_recode(array_with_index_and_table)
_test_array_recode(array_with_index_and_table)
Copy link

Copilot AI Jun 6, 2025

Choose a reason for hiding this comment

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

Removing the return value here is appropriate since _test_array_recode already asserts internally. This change prevents unnecessary return propagation that could lead to test failures.

Copilot uses AI. Check for mistakes.
@conftest.override_sparsify("none")
def test_array_recode_sparsify_none(array_with_index_and_table):
return _test_array_recode(array_with_index_and_table)
_test_array_recode(array_with_index_and_table)
Copy link

Copilot AI Jun 6, 2025

Choose a reason for hiding this comment

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

Similarly, updating this test function to not return the value from _test_array_recode ensures consistency with pytest 8.4.0 requirements. The assertion within _test_array_recode is sufficient to validate the test outcome.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@solatis solatis left a comment

Choose a reason for hiding this comment

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

Make sure to test it builds everywhere before merging.

@igorniebylski
Copy link
Contributor Author

other than flaky stats_by_node test everything is ok :)

@igorniebylski igorniebylski merged commit b6e4263 into master Jun 6, 2025
2 checks passed
@igorniebylski igorniebylski deleted the fix-pytest-breaking-changes branch June 6, 2025 11:49
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.

3 participants