Use pytest fixtures, adapt tests to refactoring