summaryrefslogtreecommitdiffstats
path: root/test_1.py
blob: 3e501767435ae9cf440d9ee8577fed5a66ae6ee7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# -*- coding:utf-8 -*-
import pytest


@pytest.fixture(scope='function')
def setup_function(request):
    def teardown_function():
        print("teardown_function called.")
    request.addfinalizer(teardown_function)  # 此内嵌函数做teardown工作
    print('setup_function called.')


@pytest.fixture(scope='module')
def setup_module(request):
    def teardown_module():
        print("teardown_module called.")
    request.addfinalizer(teardown_module)
    print('setup_module called.')


# @pytest.mark.website
def test_1(setup_function):
    print('Test_1 called.')
    assert 1 == 1