Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

layout of tests #9871

Open
d-v-b opened this issue Dec 10, 2024 · 2 comments
Open

layout of tests #9871

d-v-b opened this issue Dec 10, 2024 · 2 comments
Labels
needs triage Issue that has not been reviewed by xarray team member

Comments

@d-v-b
Copy link
Contributor

d-v-b commented Dec 10, 2024

What is your issue?

Currently the tests are stored in a flat on-disk layout, but some test files are logically grouped, e.g. the relationship between test_backends_api.py and test_backends_common.py could be expressed via a directory structure, like test/backends/test_api.py and test/backends/test_common.py.

Relatedly, some of the test files are a bit long -- test_backends.py is 6500 lines, and it contains tests for zarr and netcdf (and maybe other things). If someone is just working on the zarr side of things, then the netcdf tests are thousands of lines of clutter that could in principle be entirely contained in a separate test file.

So my proposal would be to judiciously group logically related tests into modules , e.g. test_backends would be one, and also split large test files into smaller independent components, e.g. test_backends/test_zarr.py would just test the zarr backend stuff.

Does this seem reasonable?

@d-v-b d-v-b added the needs triage Issue that has not been reviewed by xarray team member label Dec 10, 2024
@max-sixty
Copy link
Collaborator

I would definitely support breaking the tests up into separate files.

This also becomes more important as LLMs become more useful (but not yet useful enough to do much more than read a whole file...)

@max-sixty
Copy link
Collaborator

Tangentially:

I had a quick look at whether we could break up dataset.py, which is now 11K lines long. The short answer is that it's not easy — it's mostly doctrings, there's maybe 1-2K LOC of functions we could move the main logic and leave a wrapper — curvefit, polyfit, interp, a few utility functions. And it's not really possible in python to have class definitions in more than one file.

That is separate from breaking up the tests, still worthwhile if we can slim it down a bit. But no easy great solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue that has not been reviewed by xarray team member
Projects
None yet
Development

No branches or pull requests

2 participants