create pytest code example
Example 1: python run pytest
Just type this in shell:
pytest
Or this if that does nott work:
python -m pytest
Example 2: pytest create server
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()