From 582b9fe178401cb52d442fab047deb7894a04cce Mon Sep 17 00:00:00 2001 From: Chris Berkhout Date: Thu, 29 Jul 2021 16:17:44 +0200 Subject: [PATCH] No prefix to curl commands in debug log output. --- src/pricehist/sources/basesource.py | 2 +- tests/pricehist/sources/test_alphavantage.py | 6 +++--- tests/pricehist/sources/test_coindesk.py | 4 ++-- tests/pricehist/sources/test_coinmarketcap.py | 4 ++-- tests/pricehist/sources/test_ecb.py | 4 ++-- tests/pricehist/sources/test_yahoo.py | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/pricehist/sources/basesource.py b/src/pricehist/sources/basesource.py index 61d5318..3794522 100644 --- a/src/pricehist/sources/basesource.py +++ b/src/pricehist/sources/basesource.py @@ -52,7 +52,7 @@ class BaseSource(ABC): def log_curl(self, response): curl = curlify.to_curl(response.request, compressed=True) - logging.debug(f"Request to {self.id()}: {curl}") + logging.debug(curl) return response def format_symbols(self) -> str: diff --git a/tests/pricehist/sources/test_alphavantage.py b/tests/pricehist/sources/test_alphavantage.py index b585a7e..237f8e9 100644 --- a/tests/pricehist/sources/test_alphavantage.py +++ b/tests/pricehist/sources/test_alphavantage.py @@ -305,7 +305,7 @@ def test_fetch_stock_requests_logged(src, type, search_ok, ibm_ok, caplog): src.fetch(Series("IBM", "", type, "2021-01-04", "2021-01-08")) logged_requests = 0 for r in caplog.records: - if r.levelname == "DEBUG" and " curl " in r.message: + if r.levelname == "DEBUG" and "curl " in r.message: logged_requests += 1 assert logged_requests == 2 @@ -428,7 +428,7 @@ def test_fetch_physical_requests_logged(src, type, physical_list_ok, euraud_ok, src.fetch(Series("EUR", "AUD", type, "2021-01-04", "2021-01-08")) logged_requests = 0 for r in caplog.records: - if r.levelname == "DEBUG" and " curl " in r.message: + if r.levelname == "DEBUG" and "curl " in r.message: logged_requests += 1 assert logged_requests == 2 @@ -527,7 +527,7 @@ def test_fetch_digital_requests_logged( src.fetch(Series("BTC", "AUD", type, "2021-01-04", "2021-01-08")) logged_requests = 0 for r in caplog.records: - if r.levelname == "DEBUG" and " curl " in r.message: + if r.levelname == "DEBUG" and "curl " in r.message: logged_requests += 1 assert logged_requests == 3 diff --git a/tests/pricehist/sources/test_coindesk.py b/tests/pricehist/sources/test_coindesk.py index 6987c83..c53f34a 100644 --- a/tests/pricehist/sources/test_coindesk.py +++ b/tests/pricehist/sources/test_coindesk.py @@ -114,7 +114,7 @@ def test_symbols_requests_logged(src, currencies_response_ok, caplog): with caplog.at_level(logging.DEBUG): src.symbols() assert any( - ["DEBUG" == r.levelname and " curl " in r.message for r in caplog.records] + ["DEBUG" == r.levelname and "curl " in r.message for r in caplog.records] ) @@ -165,7 +165,7 @@ def test_fetch_requests_logged(src, type, recent_response_ok, caplog): with caplog.at_level(logging.DEBUG): src.fetch(Series("BTC", "AUD", type, "2021-01-01", "2021-01-07")) assert any( - ["DEBUG" == r.levelname and " curl " in r.message for r in caplog.records] + ["DEBUG" == r.levelname and "curl " in r.message for r in caplog.records] ) diff --git a/tests/pricehist/sources/test_coinmarketcap.py b/tests/pricehist/sources/test_coinmarketcap.py index ba4cc0f..a7fec0c 100644 --- a/tests/pricehist/sources/test_coinmarketcap.py +++ b/tests/pricehist/sources/test_coinmarketcap.py @@ -132,7 +132,7 @@ def test_symbols_requests_logged(src, crypto_ok, fiat_ok, caplog): src.symbols() logged_requests = 0 for r in caplog.records: - if r.levelname == "DEBUG" and " curl " in r.message: + if r.levelname == "DEBUG" and "curl " in r.message: logged_requests += 1 assert logged_requests == 2 @@ -258,7 +258,7 @@ def test_fetch_requests_logged(src, type, recent_sym_sym_ok, caplog): with caplog.at_level(logging.DEBUG): src.fetch(Series("BTC", "AUD", type, "2021-01-01", "2021-01-07")) assert any( - ["DEBUG" == r.levelname and " curl " in r.message for r in caplog.records] + ["DEBUG" == r.levelname and "curl " in r.message for r in caplog.records] ) diff --git a/tests/pricehist/sources/test_ecb.py b/tests/pricehist/sources/test_ecb.py index 2d747fe..f081342 100644 --- a/tests/pricehist/sources/test_ecb.py +++ b/tests/pricehist/sources/test_ecb.py @@ -105,7 +105,7 @@ def test_symbols_requests_logged_for(src, response_ok, caplog): with caplog.at_level(logging.DEBUG): src.symbols() assert any( - ["DEBUG" == r.levelname and " curl " in r.message for r in caplog.records] + ["DEBUG" == r.levelname and "curl " in r.message for r in caplog.records] ) @@ -134,7 +134,7 @@ def test_fetch_requests_logged(src, response_ok, caplog): with caplog.at_level(logging.DEBUG): src.fetch(Series("EUR", "AUD", type, "2021-01-04", "2021-01-08")) assert any( - ["DEBUG" == r.levelname and " curl " in r.message for r in caplog.records] + ["DEBUG" == r.levelname and "curl " in r.message for r in caplog.records] ) diff --git a/tests/pricehist/sources/test_yahoo.py b/tests/pricehist/sources/test_yahoo.py index 322e9a5..51f6ca9 100644 --- a/tests/pricehist/sources/test_yahoo.py +++ b/tests/pricehist/sources/test_yahoo.py @@ -124,7 +124,7 @@ def test_fetch_requests_logged(src, type, spark_ok, recent_ok, caplog): src.fetch(Series("TSLA", "", type, "2021-01-04", "2021-01-08")) logged_requests = 0 for r in caplog.records: - if r.levelname == "DEBUG" and " curl " in r.message: + if r.levelname == "DEBUG" and "curl " in r.message: logged_requests += 1 assert logged_requests == 2