diff options
Diffstat (limited to 'test_1.py')
-rw-r--r-- | test_1.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test_1.py b/test_1.py new file mode 100644 index 0000000..3e50176 --- /dev/null +++ b/test_1.py @@ -0,0 +1,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 |