organize tests and make py.test compatible