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

Multiple test functions rely on files that are not included in the repo by default #50

Open
1 task done
liammegill opened this issue Nov 22, 2024 · 0 comments
Open
1 task done
Assignees
Labels
module: utils Related to utility scripts type: testing Related to testing

Comments

@liammegill
Copy link
Collaborator

liammegill commented Nov 22, 2024

Type of issue

  • bug report

Description

A number of test functions (listed below) rely on files only created after running utils/create_test_files.py.

Current behaviour: On github, we have configured the automatic tests to first run this script, so there is never an error. However, if you run the tests locally and have not run the create_test_files script, you may be left wondering why there are so many errors (like I was).

Test functions that produce errors if the test files are not present:

  • calc_response_test.py: all functions
  • construct_conc_test.py: all functions
  • interpolate_space_test.py: all functions
  • read_config_test.py/TestLoadConfig: test_type and test_invalid
  • read_netcdf_test.py/TestCheckSpecAttributes: all functions

Expected behaviour: The user should be able to run the tests immediately after cloning the repository.

Suggestions for fix: I can think of three options:

  • Preferred option: Always use simple versions of the required files (config, response, inventory) that do not need to be saved to file, e.g. using a pytest fixture.
  • Run the create_test_files.py script from the test scripts if the required files are not present. This is not ideal, because you do not want the test scripts to result in saved files.
  • Write in the documentation/README that you need to run create_test_files.py before testing the program (currently implemented).

Environment:

  • oac version: v2.8.3
  • Operating system: Windows 11
@liammegill liammegill added type: testing Related to testing module: utils Related to utility scripts labels Nov 22, 2024
@liammegill liammegill changed the title Multiple test functions rely on nc file that is not included in the repo by default Multiple test functions rely on files that are not included in the repo by default Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: utils Related to utility scripts type: testing Related to testing
Projects
None yet
Development

No branches or pull requests

2 participants