Skip to content

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
@VeckoTheGecko VeckoTheGecko merged commit f0791c6 into master Sep 17, 2024
@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.

3 participants