Open mroeschke opened 9 months ago
As a way to have some test in our own code base that might remind us about this: we could run the tests for one of our own extension arrays outside of the main test directory.
For example, we have some tests in scripts/tests
that are run, and those won't pick up the pandas/conftest.py
, I think. It doesn't exactly fit in there (as it is not testing a utility, but being an actual test in itself), but putting it there makes that we can easily use the workflow that already run those tests anyway (or without having to add a specific extra step in the CI setup. Not that this would be that complicated, though)
Concretely, the tests in pandas/tests/extension/test_datetime.py
seem fairly complete and not too complex (not much overrides or skips). We could duplicate the content of that file with some minor edits in a file like scripts/tests/test_extension_array_tests_fixtures.py
. That would ensure whenever we use a new fixture in the extension tests, it reminds us about this setup, and ensure we use fixtures from pandas/tests/extension/conftest.py
.
I've noticed at least the following fixtures are problematic in this regards:
geopandas currently needs to copy over some fixtures used in our base EA tests which is not ideal for portability.
https://github.com/geopandas/geopandas/blob/08c23312edd8b0df25621f0fc77417840efe1fb5/geopandas/tests/test_extension_array.py#L246-L247
Ideally we should have a check that these tests do no use any external fixtures defined in
pandas/conftest.py
or ensurepandas/tests/extension/conftest.py
contains the needed fixtures and instruct authors to copy over this file as well.