Closed edbennett closed 5 months ago
This is still open: currently running pytest
gives the message "no tests ran".
Current issues:
test
test_import
is redundant, since all other tests will perform a similar import that fails. test_invert.py
should be in a function.test_periodicity.py
) once they are named such that pytest
will pick them uptest_invert.py
and test_setprec.py
have an init_precision
function that doesn't seem to do anything. (Note that print
outputs will be swallowed by pytest
to avoid cluttering output.)If anything's unclear, I'd suggest having a read of an introductory tutorial on using pytest (e.g. this one)
pytest fails finding modules for me on all tests ( ModuleNotFoundError: No module named 'lsdensities')
while python -m pytest works
Indeed the tests should have assertions. I am planning to write a new bunch of them in the close future, the ones that we have now are very basic.
test_periodicity is I think one of the most useful and was badly set up to produce plots for visual inspection, no assertions. We can put one on the values of f_t at large t matching f_t at infinite t.
It seems to be this test was broken since the S_matrix plot has now more content than it should have. EDIT: it is just pytest breakin the plots, not the program itself. I guess it's bad design. I'll put an assertion :)
possibly solved by 4f2f701
pytest fails finding modules for me on all tests ( ModuleNotFoundError: No module named 'lsdensities')
while python -m pytest works
this persists but I don't think it is a problem
If pytest
does not work but python -m pytest
does, then this is an issue with your setup—you have pytest
installed in your PATH
somewhere that has higher precedence than your current virtual environment, and so it runs with the environment it's installed in rather than the one you want.
(Using python -m pytest
by default is frequently a good idea for this reason.)
Is this issue still to be completed?
test_integration.py
should have a test function in. You can get timings for how long each test takes using (python -m
) pytest --durations=0
. In that case, then the test in that file should actually test something—there should be an assert
that the value of integral
is correct.test_init_precision
actually checked that the precision has been correctly initialised.tests/test_periodicity.py
, and the last three lines of tests/test_setprec.py
should be removed.tests/Smatrix_periodicity_check.png
and tests/ft_periodicity_check.png
for? They don't seem to be used for anything, and should probably be removed.Ok, I should have addressed your points, and there are asserts and pytest succeed in running too.
I've checked off the bullets that have been addressed from my previous message—looks like there's one test that still doesn't test anything?
Woops, sorry I didn't notice that. I corrected it now.
Currently the
tests
directory contains programs with amain()
function that outputs the result of a check; it would be better to use an automated testing tool likepytest
for this instead—this will reduce the amount of code, make it more easily automated, and make it easier to read for others who are already familiar with pytest.