#D:\pythonProject0726\test_case\test_one.py import time def setup_module(): print('准备测试数据') def teardown_module(): print('清理测试数据') def test_oneone(): ex=1 real=1 time.sleep(3) print('1==1') assert ex==real def test_oneonr(): ex1=1 real1=1 time.sleep(3) print('1==1') assert ex1==real1
# D:\pythonProject0726\test_case\test_two.py import time def test001(): print('准备测试数据2') def teardown_module(): print('清理测试数据2') def test_twoy(): ex=1 real=2 time.sleep(3) print('1==2') assert ex==real def test_twou(): ex=1 real=2 time.sleep(3) print('1==2') assert ex==real
# D:\pythonProject0726\test_case\all_test_case.py import pytest import xdist if __name__ == '__main__': pytest.main(['-vs'])
终端
pytest -vs test_case -k "test001"
标签:real,py,print,pytest,参数,ex,time,test,def From: https://www.cnblogs.com/haha1988/p/17602899.html