Fixed ./setup.py test.
Moved some tests into functions so test files will show up in pytest output.