Skip to content

Maintenance on test infrastructure

Vicentini Filippo requested to merge test into master

Created by: PhilipVinc

This PR does two things and hopefully does it well:

  • Skip legacy tests by default
  • Allow the whole test folder to be run under MPI so that we can start adding more tests with MPI in mind (I want to add MPI tests to the set of SR PRs..., but also start testing things in variational state & co).

With this PR one can now check that netket works by running tests as pytest . and mpirun -np 2 pytest -n0.

This is implemented in the following way:

  • Create a common.py object at the root of our Test folder to put some shared things among all tests

    • Because of this, all tests must be modules so it adds a __init__.py file in every folder in the tests (uglyugly, i know, but i could not find a way to avoid this)
  • Mark most tests not to run when under MPI. This is done with a module level fixture for things like graph, hilbert, etc where we have no tests for MPI, and is done with a mark on the single test on SR tests.

  • Adds a bunch of fixtures to be used when running tests under MPI providing number of ranks, etc.

  • Adds an object to run code in netket as if there was no MPI (even if there is MPI) (see usages in https://github.com/netket/netket/blob/e11c9837c84b8854004467e212737e1a6e7331e6/Test/Optimizer/test_sr_itersolve.py )

  • Marks all tests in legacy as legacy tests

    • adds a commandline option to use when running tests --legacy (and --legacy-only) to run also/only legacy tests.
  • Slightly reorganise the github action for tests

    • In the future, if our MPI tests become long, we can split them out to their own runner so that test clock time is lower
  • Fix a typo in codecov.yml, that was supposed to ignore coverage in legacy.

Merge request reports