mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-19 15:28:28 +01:00
tests: remove use of mocker as context-manager (#3480)
This commit is contained in:
@@ -22,14 +22,12 @@ def test_failed_import_url(mocker, caplog):
|
||||
assert cli_args.func == CmdImportUrl
|
||||
|
||||
cmd = cli_args.func(cli_args)
|
||||
with mocker.patch.object(
|
||||
cmd.repo, "imp_url", side_effect=DvcException("error")
|
||||
):
|
||||
with caplog.at_level(logging.ERROR, logger="dvc"):
|
||||
assert cmd.run() == 1
|
||||
expected_error = (
|
||||
"failed to import http://somesite.com/file_name. "
|
||||
"You could also try downloading it manually, and "
|
||||
"adding it with `dvc add`."
|
||||
)
|
||||
assert expected_error in caplog.text
|
||||
mocker.patch.object(cmd.repo, "imp_url", side_effect=DvcException("error"))
|
||||
with caplog.at_level(logging.ERROR, logger="dvc"):
|
||||
assert cmd.run() == 1
|
||||
expected_error = (
|
||||
"failed to import http://somesite.com/file_name. "
|
||||
"You could also try downloading it manually, and "
|
||||
"adding it with `dvc add`."
|
||||
)
|
||||
assert expected_error in caplog.text
|
||||
|
||||
Reference in New Issue
Block a user