From 94e85686b5a83a13ef7b94542b7a1b16ac1c4184 Mon Sep 17 00:00:00 2001 From: Adam Hopkins Date: Sun, 30 Dec 2018 14:07:21 +0200 Subject: [PATCH] Ignore first row of logs when no uvloop --- tests/test_logo.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/tests/test_logo.py b/tests/test_logo.py index b98f77e5..c99ee5b6 100644 --- a/tests/test_logo.py +++ b/tests/test_logo.py @@ -1,9 +1,14 @@ import logging import asyncio -import pytest from sanic.config import BASE_LOGO +try: + import uvloop # noqa + ROW = 0 +except BaseException: + ROW = 1 + def test_logo_base(app, caplog): server = app.create_server(debug=True) @@ -18,7 +23,8 @@ def test_logo_base(app, caplog): loop.run_until_complete(_server.wait_closed()) app.stop() - assert caplog.record_tuples[0] == ("sanic.root", logging.DEBUG, BASE_LOGO) + assert caplog.record_tuples[ROW][1] == logging.DEBUG + assert caplog.record_tuples[ROW][2] == BASE_LOGO def test_logo_false(app, caplog): @@ -36,11 +42,8 @@ def test_logo_false(app, caplog): loop.run_until_complete(_server.wait_closed()) app.stop() - assert caplog.record_tuples[0] == ( - "sanic.root", - logging.INFO, - "Goin' Fast @ http://127.0.0.1:8000", - ) + assert caplog.record_tuples[ROW][1] == logging.INFO + assert caplog.record_tuples[ROW][2] == "Goin' Fast @ http://127.0.0.1:8000" def test_logo_true(app, caplog): @@ -58,7 +61,8 @@ def test_logo_true(app, caplog): loop.run_until_complete(_server.wait_closed()) app.stop() - assert caplog.record_tuples[0] == ("sanic.root", logging.DEBUG, BASE_LOGO) + assert caplog.record_tuples[ROW][1] == logging.DEBUG + assert caplog.record_tuples[ROW][2] == BASE_LOGO def test_logo_custom(app, caplog): @@ -76,8 +80,5 @@ def test_logo_custom(app, caplog): loop.run_until_complete(_server.wait_closed()) app.stop() - assert caplog.record_tuples[0] == ( - "sanic.root", - logging.DEBUG, - "My Custom Logo", - ) + assert caplog.record_tuples[ROW][1] == logging.DEBUG + assert caplog.record_tuples[ROW][2] == "My Custom Logo"