Skip to content

Commit 89502be

Browse files
author
n3hrox
committed
fix tests
1 parent 8ae1165 commit 89502be

File tree

2 files changed

+9
-31
lines changed

2 files changed

+9
-31
lines changed

tests/func/test_remote.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,5 +245,5 @@ def unreliable_upload(self, from_file, to_info, name=None, **kwargs):
245245

246246

247247
def get_last_exc(caplog):
248-
_, exc, _ = caplog.records[-1].exc_info
248+
_, exc, _ = caplog.records[-2].exc_info
249249
return exc

tests/unit/test_logger.py

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@ def test_error(self, caplog):
4545
with caplog.at_level(logging.INFO, logger="dvc"):
4646
logger.error("message")
4747

48-
expected = (
49-
"{red}ERROR{nc}: message\n"
50-
"\n"
51-
"{footer}".format(footer=formatter.footer, **colors)
52-
)
48+
expected = "{red}ERROR{nc}: message\n".format(**colors)
5349

5450
assert expected == formatter.format(caplog.records[0])
5551

@@ -60,11 +56,7 @@ def test_exception(self, caplog):
6056
except Exception:
6157
logger.exception("message")
6258

63-
expected = (
64-
"{red}ERROR{nc}: message\n"
65-
"\n"
66-
"{footer}".format(footer=formatter.footer, **colors)
67-
)
59+
expected = "{red}ERROR{nc}: message\n".format(**colors)
6860

6961
assert expected == formatter.format(caplog.records[0])
7062

@@ -75,11 +67,7 @@ def test_exception_with_description_and_without_message(self, caplog):
7567
except Exception:
7668
logger.exception("")
7769

78-
expected = (
79-
"{red}ERROR{nc}: description\n"
80-
"\n"
81-
"{footer}".format(footer=formatter.footer, **colors)
82-
)
70+
expected = "{red}ERROR{nc}: description\n".format(**colors)
8371

8472
assert expected == formatter.format(caplog.records[0])
8573

@@ -90,10 +78,8 @@ def test_exception_with_description_and_message(self, caplog):
9078
except Exception:
9179
logger.exception("message")
9280

93-
expected = (
94-
"{red}ERROR{nc}: message - description\n"
95-
"\n"
96-
"{footer}".format(footer=formatter.footer, **colors)
81+
expected = "{red}ERROR{nc}: message - description\n".format(
82+
**colors
9783
)
9884

9985
assert expected == formatter.format(caplog.records[0])
@@ -110,13 +96,8 @@ def test_exception_under_verbose(self, caplog):
11096
"{red}ERROR{nc}: description\n"
11197
"{red}{line}{nc}\n"
11298
"{stack_trace}"
113-
"{red}{line}{nc}\n"
114-
"\n"
115-
"{footer}".format(
116-
footer=formatter.footer,
117-
line="-" * 60,
118-
stack_trace=stack_trace,
119-
**colors
99+
"{red}{line}{nc}\n".format(
100+
line="-" * 60, stack_trace=stack_trace, **colors
120101
)
121102
)
122103

@@ -138,10 +119,7 @@ def test_nested_exceptions(self, caplog):
138119
"{red}ERROR{nc}: message - second: first\n"
139120
"{red}{line}{nc}\n"
140121
"{stack_trace}"
141-
"{red}{line}{nc}\n"
142-
"\n"
143-
"{footer}".format(
144-
footer=formatter.footer,
122+
"{red}{line}{nc}\n".format(
145123
line="-" * 60,
146124
stack_trace="\n".join([first_traceback, second_traceback]),
147125
**colors

0 commit comments

Comments
 (0)