Skip to content

Improve tests and notebooks#553

Merged
rubencalje merged 13 commits intodevfrom
improve_tests_and_notebooks
Mar 18, 2026
Merged

Improve tests and notebooks#553
rubencalje merged 13 commits intodevfrom
improve_tests_and_notebooks

Conversation

@rubencalje
Copy link
Copy Markdown
Collaborator

@rubencalje rubencalje commented Mar 17, 2026

This PR makes sure notebooks and tests produce output in folder that are not committed to Git:

  • the models in the notebooks are run in a folder with the same name as the notebook. we make sure this folder is included in gitignore.
  • the tests are run inside a temporary folder that is written to an environmental variable, so it can be used by other tests. This environmental variable is created when test are created outside pytest.

Also this PR improves some tests:

  • remove 3 of the sea_model tests in test_001_model.py, as these tests only add 3 extra covered lines, have a lot of duplicate code and take a long time.
  • Use tmp_path instead of tmpdir
  • Fix some of the warnings pytest shows
  • Make sure to close all figures and close handles to netcdf file at every test (in conftest.py). This might have been the reason for the freezed tests before.
  • Add extra tests using copilot
  • add test for nlmod.read.administrative.download_kadaster_percelen
  • do not use deprecated methods in anymore, but use the replacements (download_ instead of get_)

Some other changes:

  • remove broken 'year' argument in download_percelen_gdf
  • remove tight_layout where applicable from plot-methods
  • add custom.css so dataframes in documenttaion look nice again (after the update of myst-nb)

@rubencalje rubencalje requested a review from dbrakenhoff March 18, 2026 10:19
Copy link
Copy Markdown
Collaborator

@dbrakenhoff dbrakenhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Didn´t check it all super carefully, and the new monkeypatch tests are a bit hard to follow but I'm sure if the tests pass and run quickly this is is a big improvement.

@rubencalje
Copy link
Copy Markdown
Collaborator Author

Yes, the monkeypatch-stuff is what copilot came up with when I asked to increase the coverage. They are all in the last two test-files, so easy to remove again.

@rubencalje rubencalje merged commit 81b0783 into dev Mar 18, 2026
5 checks passed
@rubencalje rubencalje deleted the improve_tests_and_notebooks branch March 18, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants