You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The data loader functions gmx_benzene_dHdl() and gmx_benzene_u_nk() are called at the time when pytest collects tests. This slows down the test setup phase substantially (it's done in serial) and it also has the potential to fill up memory.
Solution
Make sure that the loader function is only evaluated inside the test.
#278)
- fix#206
- speed up tests by avoiding to evaluate fixtures at test collection time
- reorganized fixtures: fixtures that load data are now global in `conftest.py`
- updated tests
- updated CHANGES
Problem
Our tests contain examples of parametrizing over different datasets by calling the data loader function in the
pytest.mark.parametrize
such asalchemlyb/src/alchemlyb/tests/test_preprocessing.py
Lines 66 to 69 in 72622c9
The data loader functions
gmx_benzene_dHdl()
andgmx_benzene_u_nk()
are called at the time when pytest collects tests. This slows down the test setup phase substantially (it's done in serial) and it also has the potential to fill up memory.Solution
Make sure that the loader function is only evaluated inside the test.
Use pytest's getfixturevalue
Use
request.getfixturevalue(fixture_name)
to dynamically run the fixture function namedfixture_name
Should probably look like
Note that in the example above, the
dataloader
is the name of a pytest fixture and not an ordinary function (as currently implemented in our tests).Current hacky solution in alchemlyb
Instead, only pass the function objects to a parametrized fixture and then evaluate inside the parametrized fixture itself, as shown, for example in
alchemlyb/src/alchemlyb/tests/test_fep_estimators.py
Lines 151 to 168 in 72622c9
TODO
The text was updated successfully, but these errors were encountered: