Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
n3hrox committed Nov 1, 2019
1 parent 8ae1165 commit 89502be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 31 deletions.
2 changes: 1 addition & 1 deletion tests/func/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,5 +245,5 @@ def unreliable_upload(self, from_file, to_info, name=None, **kwargs):


def get_last_exc(caplog):
_, exc, _ = caplog.records[-1].exc_info
_, exc, _ = caplog.records[-2].exc_info
return exc
38 changes: 8 additions & 30 deletions tests/unit/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ def test_error(self, caplog):
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])

Expand All @@ -60,11 +56,7 @@ def test_exception(self, caplog):
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])

Expand All @@ -75,11 +67,7 @@ def test_exception_with_description_and_without_message(self, caplog):
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])

Expand All @@ -90,10 +78,8 @@ def test_exception_with_description_and_message(self, caplog):
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])
Expand All @@ -110,13 +96,8 @@ def test_exception_under_verbose(self, caplog):
"{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
)
)

Expand All @@ -138,10 +119,7 @@ def test_nested_exceptions(self, caplog):
"{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
Expand Down

0 comments on commit 89502be

Please sign in to comment.