Skip to content

Conversation

@mroeschke
Copy link
Member

Since most of the fixtures documentation that a copy is made to avoid changing attributes of Index/Series, a shallow copy should just be necessary instead of using a deep copy. But IMO tests should not be mutating fixtures

@mroeschke mroeschke added this to the 3.0 milestone Nov 3, 2025
@mroeschke mroeschke added the Testing pandas testing functions or related to the test suite label Nov 3, 2025
def test_to_xarray_index_types(self, index_flat, request):
# MultiIndex is tested in test_to_xarray_with_multiindex
index = index_flat
index = index_flat.copy(deep=False)
Copy link
Member

Choose a reason for hiding this comment

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

not a super-strong opinion, but needing to do this as a policy feels weird.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK sure I can remove this case, but generally I feel like always some risk mutating a pytest fixture

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough, I won’t complain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Testing pandas testing functions or related to the test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants