File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -234,11 +234,24 @@ def test_main_when_given_destination_protocol_via_cli_passes_port_to_get_logger(
234234 assert actual == expected
235235
236236
237- def test_main_when_get_logger_raises_io_error_causes_exit (patches ):
237+ def test_main_when_get_logger_raises_io_error_without_errno_61_print_error_about_file_path (patches , capsys ):
238238 patches .get_logger .side_effect = IOError
239239 with pytest .raises (SystemExit ):
240240 main .main ()
241241
242+ assert "file path" in capsys .readouterr ().out .lower ()
243+
244+
245+ def test_main_when_get_logger_raises_io_error_with_errno_61_prints_error_about_hostname (patches , capsys ):
246+ err = IOError ()
247+ err .errno = 61
248+ patches .get_logger .side_effect = err
249+
250+ with pytest .raises (SystemExit ):
251+ main .main ()
252+
253+ assert "hostname" in capsys .readouterr ().out .lower ()
254+
242255
243256def test_main_when_get_logger_raises_h_error_causes_exit (patches ):
244257 patches .get_logger .side_effect = gaierror
You can’t perform that action at this time.
0 commit comments