文档:https://docs.pytest.org/en/stable/
安装
pip install pytest
测试文件 test_hello.py
# -*- coding: utf-8 -*- import pytest # test_开头 def test_hello(): print('hello') if __name__ == '__main__': # 命令行运行 $ pytest pytest.main(['-s', __file__])
文档:https://docs.pytest.org/en/stable/
安装
pip install pytest
测试文件 test_hello.py
# -*- coding: utf-8 -*- import pytest # test_开头 def test_hello(): print('hello') if __name__ == '__main__': # 命令行运行 $ pytest pytest.main(['-s', __file__])