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

Upgrade pytest in nix environment to at least version 7.3.0 #380

Open
spencerkclark opened this issue Aug 28, 2023 · 0 comments
Open

Upgrade pytest in nix environment to at least version 7.3.0 #380

spencerkclark opened this issue Aug 28, 2023 · 0 comments

Comments

@spencerkclark
Copy link
Member

The nix environment currently uses pytest version 6.2.3, which was released in April of 2021:

[nix-shell:~/fv3gfs-fortran]$ pytest --version
pytest 6.2.3

Versions 7.3.0 and above include a feature that allows temporary directories to be cleaned up immediately after successfully tests, rather than automatically preserved for three iterations of tests. Since the tests in this repository involve creating temporary directories that contain all the input data required to run the model, these directories rapidly fill up hard disk space, which is inconvenient since these directories are currently not automatically cleaned up.

See this issue for clarification of the current temporary directory behavior in pytest, and this issue and this PR for the new feature. Leveraging the feature would essentially involve adding a single line to our pytest.ini file:

tmp_path_retention_policy = "failed"
spencerkclark added a commit that referenced this issue Sep 7, 2023
This PR refactors the build infrastructure in this repo to eliminate the need for the Docker component.  All development and testing is now done in the `nix` shell.  This should be a quality of life improvement for anyone developing the fortran model, as it no longer requires maintaining checksums in two separate build environments.

In so doing it introduces the following changes:
- New `make` rules are provided for compiling the model in different modes:
  - `build` -- build executables in `repro` (our production mode) and `debug` mode.
  - `build_repro` -- build only the `repro` mode executable.
  - `build_debug` -- build only the `debug` mode executable.
- Tests are run with each of the executables available in the local `bin` directory, and are tagged with the associated compile mode.  
- An option, `check_layout_invariance`, is provided to trigger regression tests be run with a 1x2 domain decomposition instead of a 1x1 domain decomposition to check invariance to the domain decomposition layout; this is used for the all the coarse-graining regression tests and replaces the previous `test_run_reproduces_across_layouts` test that would run in the docker image.
- `debug`-mode and `repro`-mode simulations produce different answers, which is something we noticed in #364 when upgrading compiler versions as well, and so require different reference checksums.

In working on this PR, we ran the fortran model in `debug` mode in more contexts than we had previously, some of which turned up errors, which we currently work around by using `pytest.skip` (something we had implicitly already been doing before):
- #365
- #381 

Working on this PR also brought my attention to the fact that `pytest`'s `tmpdir` fixture does not automatically get cleaned up after each test; `pytest` versions older than 7.3.0 keep around directories from the last three runs of `pytest`, which fill up disk space quickly since running these tests requires creating 10's of run directories, each with their own initial conditions and input files (#380).  For the time being I manually clean up these run directories after successful tests.

Resolves #340.
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

No branches or pull requests

1 participant