Writing functional tests with pytest