📜  pytest 创建服务器 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:54.932000             🧑  作者: Mango

代码示例1
def server(host, port):
    # definition of your server

@pytest.fixture(autouse=True, scope="session")
def start_server():
    p = multiprocessing.Process(target=server, args=(host, port))
    p.start()
    yield
    p.terminate()