Skip to content

Instantly share code, notes, and snippets.

@ryanc414
Created April 19, 2020 17:02
Show Gist options
  • Save ryanc414/feeae7eda3253cac69af6aba65442558 to your computer and use it in GitHub Desktop.
Save ryanc414/feeae7eda3253cac69af6aba65442558 to your computer and use it in GitHub Desktop.
@pytest.fixture
def app():
app = App()
print("Starting app")
app.start()
yield app
print("Stopping app")
app.stop()
def test_app(app):
"""Test making an HTTP request to my app."""
rsp = requests.get(f"{app.listen_addr}/hello")
assert rsp.status_code == 200
assert rsp.text == 'Hello, "/hello"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment