Closed tfrederiksen closed 3 years ago
Looks good! Then we can use this format for the other test files. I guess that there is an option to run each test separately?
What I typically do is to mark
a test, then one can run individual tests using:
@pytest.mark.only
def test_*(...):
...
then do
pytest --pyargs Hubbard -m only
one can also run by name, but that requires full path + test names. A bit more verbose. The above I use frequently for testing purposes and I also group tests together, say pytest --pyarg sisl -m hamiltonain
to test only stuff related to the Hamiltonian.
Thanks for the feedback. Another simple way to run a subset of tests of sisl
is to use pytest --pyargs sisl.physics
etc. But this is not as fine-grained as the mark
method, I guess.
Thanks for the feedback. Another simple way to run a subset of tests of
sisl
is to usepytest --pyargs sisl.physics
etc. But this is not as fine-grained as themark
method, I guess.
Yeah exactly, it isn't really necessary to do any of these things, one can customize pytest a lot! ;)
I actually think you should just put this PR in Hubbard, tests can always be added. :)
I was playing a bit around with
pytest
and introduced a quick check of some key functions.More stuff could/should probably be added before merging into master.
Remember to stick to the naming scheme of (sub)directories called
tests
containing filestest_*.py
.To run all tests simply execute:
See also #5 .