Here we’ll look at this module and how you can use pipes to manipulate the input and output of the spawned subprocess. I like how this version polls for a successful HEAD request (a trick inspired by pytest-simplehttpserver) rather than just sleeping. The Python subprocess module (used for starting subprocesses) is one module that provides scope for heavy usage of pipes. Raise RuntimeError( "Failed to start http server")Īgain, including static_server as a fixture is enough to ensure requests to will be served by that temporary server. Yield process break except ConnectionRefusedError: fixture( scope = "module") def static_server(): client import HTTPConnection root = pathlib. From subprocess import Popen, PIPE import pathlib import pytest import time from http.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |