需求 需要在运行时指定服务器,即服务器名称参数化 官方文档 https://docs.pytest.org/en/latest/example/simple.html –> Pass different values to a test function, depending on command line options 实例代码 conftest.py 文件 def pytest_addoption(parser): parser.addoption( "--ip_type", action="store", default="test_terminal"