Fix printing stack trace while running tests