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

Test suite tooling #1704

Merged
merged 13 commits into from
Sep 17, 2024
Merged

Test suite tooling #1704

merged 13 commits into from
Sep 17, 2024

Conversation

VeckoTheGecko
Copy link
Contributor

@VeckoTheGecko VeckoTheGecko commented Sep 16, 2024

Currently the test suite is quite disconnected, where each test module is self reliant to generate its own Fields/FieldSets and fixtures for testing.

This PR introduces tooling via the tests.utils and tests.common_kernels modules for the sharing of code (utility functions, kernels, and test data generation) between tests. This has multiple benefits:

  • Better organisation/code overview, enabling a standard collection of FieldSets to be used for testing
    • Reduces the size of the test suite, as calls toField.from_data() aren't necessary in most cases. Also helping readability
    • Makes it easier to write tests, as selecting test data is less of a concern
  • Kernels used commonly in tests can be imported instead of rewritten.

Other changes:

  • Move fieldset generation and provide quick documentation
  • Remove redundant fieldset
  • Cleans test functions' arguments (such that only pytest params and fixtures are there. Test constants are moved to function body)
  • Update filepath handling for test data reducing code duplication

Further refactoring of tests - including the use of common fieldsets, and creating global fixtures in a conftest.py - can be done in future in a piecemeal approach as needed.

Related to #1684

@VeckoTheGecko VeckoTheGecko changed the title Test suite revamp Test suite tooling Sep 17, 2024
@VeckoTheGecko VeckoTheGecko marked this pull request as ready for review September 17, 2024 08:54
tests/common_kernels.py Outdated Show resolved Hide resolved
tests/test_advection.py Show resolved Hide resolved
tests/test_mpirun.py Show resolved Hide resolved
tests/utils.py Outdated Show resolved Hide resolved
tests/utils.py Outdated Show resolved Hide resolved
tests/common_kernels.py Outdated Show resolved Hide resolved
@VeckoTheGecko VeckoTheGecko merged commit f0791c6 into master Sep 17, 2024
9 of 11 checks passed
@VeckoTheGecko VeckoTheGecko deleted the v/test-suite branch September 17, 2024 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants