Added setup and teardown methods for test_engine when run with pytest.