2009-04-29 01:49:48 +08:00
|
|
|
|
2009-05-21 20:36:52 +08:00
|
|
|
def pytest_funcarg__setup(request):
|
|
|
|
return request.cached_setup(
|
2010-07-27 03:15:15 +08:00
|
|
|
setup=lambda: CostlySetup(),
|
2009-05-21 20:36:52 +08:00
|
|
|
teardown=lambda costlysetup: costlysetup.finalize(),
|
|
|
|
scope="session",
|
|
|
|
)
|
2009-04-29 01:49:48 +08:00
|
|
|
|
2009-05-13 07:47:32 +08:00
|
|
|
class CostlySetup:
|
2009-04-29 01:49:48 +08:00
|
|
|
def __init__(self):
|
|
|
|
import time
|
|
|
|
time.sleep(5)
|
|
|
|
self.timecostly = 1
|
|
|
|
|
|
|
|
def finalize(self):
|
2010-07-27 03:15:15 +08:00
|
|
|
del self.timecostly
|