summaryrefslogtreecommitdiff
path: root/doc/en/example/costlysetup/conftest.py
blob: 57b08b5fa94329c64b063468a5a6bdc83ce28bb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import pytest


@pytest.fixture("session")
def setup(request):
    setup = CostlySetup()
    yield setup
    setup.finalize()


class CostlySetup(object):
    def __init__(self):
        import time

        print("performing costly setup")
        time.sleep(5)
        self.timecostly = 1

    def finalize(self):
        del self.timecostly