test_ok1/doc/en/example/costlysetup/conftest.py

21 lines
344 B
Python
Raw Normal View History

import pytest
2018-05-23 22:48:46 +08:00
@pytest.fixture("session")
def setup(request):
setup = CostlySetup()
yield setup
setup.finalize()
2018-05-23 22:48:46 +08:00
class CostlySetup(object):
def __init__(self):
import time
2018-05-23 22:48:46 +08:00
print("performing costly setup")
time.sleep(5)
self.timecostly = 1
def finalize(self):
del self.timecostly