From 89502bee88216f2c9cbb99765d8fbc1aa5e31eb0 Mon Sep 17 00:00:00 2001 From: n3hrox Date: Fri, 1 Nov 2019 18:05:27 +0100 Subject: [PATCH] fix tests --- tests/func/test_remote.py | 2 +- tests/unit/test_logger.py | 38 ++++++++------------------------------ 2 files changed, 9 insertions(+), 31 deletions(-) diff --git a/tests/func/test_remote.py b/tests/func/test_remote.py index b938f97f4..af9d041cf 100644 --- a/tests/func/test_remote.py +++ b/tests/func/test_remote.py @@ -245,5 +245,5 @@ def test_partial_push_n_pull(dvc_repo, repo_dir, caplog): def get_last_exc(caplog): - _, exc, _ = caplog.records[-1].exc_info + _, exc, _ = caplog.records[-2].exc_info return exc diff --git a/tests/unit/test_logger.py b/tests/unit/test_logger.py index 5560acd4e..bcc061ff3 100644 --- a/tests/unit/test_logger.py +++ b/tests/unit/test_logger.py @@ -45,11 +45,7 @@ class TestColorFormatter: with caplog.at_level(logging.INFO, logger="dvc"): logger.error("message") - expected = ( - "{red}ERROR{nc}: message\n" - "\n" - "{footer}".format(footer=formatter.footer, **colors) - ) + expected = "{red}ERROR{nc}: message\n".format(**colors) assert expected == formatter.format(caplog.records[0]) @@ -60,11 +56,7 @@ class TestColorFormatter: except Exception: logger.exception("message") - expected = ( - "{red}ERROR{nc}: message\n" - "\n" - "{footer}".format(footer=formatter.footer, **colors) - ) + expected = "{red}ERROR{nc}: message\n".format(**colors) assert expected == formatter.format(caplog.records[0]) @@ -75,11 +67,7 @@ class TestColorFormatter: except Exception: logger.exception("") - expected = ( - "{red}ERROR{nc}: description\n" - "\n" - "{footer}".format(footer=formatter.footer, **colors) - ) + expected = "{red}ERROR{nc}: description\n".format(**colors) assert expected == formatter.format(caplog.records[0]) @@ -90,10 +78,8 @@ class TestColorFormatter: except Exception: logger.exception("message") - expected = ( - "{red}ERROR{nc}: message - description\n" - "\n" - "{footer}".format(footer=formatter.footer, **colors) + expected = "{red}ERROR{nc}: message - description\n".format( + **colors ) assert expected == formatter.format(caplog.records[0]) @@ -110,13 +96,8 @@ class TestColorFormatter: "{red}ERROR{nc}: description\n" "{red}{line}{nc}\n" "{stack_trace}" - "{red}{line}{nc}\n" - "\n" - "{footer}".format( - footer=formatter.footer, - line="-" * 60, - stack_trace=stack_trace, - **colors + "{red}{line}{nc}\n".format( + line="-" * 60, stack_trace=stack_trace, **colors ) ) @@ -138,10 +119,7 @@ class TestColorFormatter: "{red}ERROR{nc}: message - second: first\n" "{red}{line}{nc}\n" "{stack_trace}" - "{red}{line}{nc}\n" - "\n" - "{footer}".format( - footer=formatter.footer, + "{red}{line}{nc}\n".format( line="-" * 60, stack_trace="\n".join([first_traceback, second_traceback]), **colors