2009-04-29 01:49:48 +08:00
|
|
|
|
2012-08-13 18:58:08 +08:00
|
|
|
import pytest
|
|
|
|
|
2012-10-05 16:21:35 +08:00
|
|
|
@pytest.fixture("session")
|
2012-09-17 22:36:10 +08:00
|
|
|
def setup(request):
|
2012-08-13 18:58:08 +08:00
|
|
|
setup = CostlySetup()
|
2016-06-08 07:59:58 +08:00
|
|
|
yield setup
|
|
|
|
setup.finalize()
|
2009-04-29 01:49:48 +08:00
|
|
|
|
2017-02-17 02:41:51 +08:00
|
|
|
class CostlySetup(object):
|
2009-04-29 01:49:48 +08:00
|
|
|
def __init__(self):
|
|
|
|
import time
|
2010-11-21 04:35:55 +08:00
|
|
|
print ("performing costly setup")
|
2009-04-29 01:49:48 +08:00
|
|
|
time.sleep(5)
|
|
|
|
self.timecostly = 1
|
|
|
|
|
|
|
|
def finalize(self):
|
2010-07-27 03:15:15 +08:00
|
|
|
del self.timecostly
|