Skip to content

Commit fa2f5b9

Browse files
committed
fix tests in pytest.raises blocks
1 parent 07232e9 commit fa2f5b9

File tree

1 file changed

+28
-21
lines changed

1 file changed

+28
-21
lines changed

tests/test_main.py

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,10 @@ def test_main_filepath_validations_false_firstfont(capsys):
5858

5959
with pytest.raises(SystemExit) as exit_info:
6060
run(args)
61-
captured = capsys.readouterr()
62-
assert captured.error.startswith("[*] ERROR: The file path")
63-
assert exit_info.value.code == 1
61+
62+
captured = capsys.readouterr()
63+
assert captured.err.startswith("[*] ERROR: The file path")
64+
assert exit_info.value.code == 1
6465

6566

6667
def test_main_filepath_validations_false_secondfont(capsys):
@@ -69,9 +70,10 @@ def test_main_filepath_validations_false_secondfont(capsys):
6970

7071
with pytest.raises(SystemExit) as exit_info:
7172
run(args)
72-
captured = capsys.readouterr()
73-
assert captured.error.startswith("[*] ERROR: The file path")
74-
assert exit_info.value.code == 1
73+
74+
captured = capsys.readouterr()
75+
assert captured.err.startswith("[*] ERROR: The file path")
76+
assert exit_info.value.code == 1
7577

7678

7779
#
@@ -83,9 +85,10 @@ def test_main_include_exclude_defined_simultaneously(capsys):
8385

8486
with pytest.raises(SystemExit) as exit_info:
8587
run(args)
86-
captured = capsys.readouterr()
87-
assert captured.error.startswith("[*] Error: --include and --exclude are mutually exclusive options")
88-
assert exit_info.value.code == 1
88+
89+
captured = capsys.readouterr()
90+
assert captured.err.startswith("[*] Error: --include and --exclude are mutually exclusive options")
91+
assert exit_info.value.code == 1
8992

9093

9194
#
@@ -286,39 +289,43 @@ def test_main_include_with_bad_table_definition(capsys):
286289

287290
with pytest.raises(SystemExit) as exit_info:
288291
run(args)
289-
captured = capsys.readouterr()
290-
assert captured.error.startswith("[*] ERROR:")
291-
assert exit_info.value.code == 1
292+
293+
captured = capsys.readouterr()
294+
assert captured.err.startswith("[*] ERROR:")
295+
assert exit_info.value.code == 1
292296

293297

294298
def test_main_include_with_bad_table_definition_in_multi_table_request(capsys):
295299
args = ["--include", "head,bogus", ROBOTO_BEFORE_PATH, ROBOTO_AFTER_PATH]
296300

297301
with pytest.raises(SystemExit) as exit_info:
298302
run(args)
299-
captured = capsys.readouterr()
300-
assert captured.error.startswith("[*] ERROR:")
301-
assert exit_info.value.code == 1
303+
304+
captured = capsys.readouterr()
305+
assert captured.err.startswith("[*] ERROR:")
306+
assert exit_info.value.code == 1
302307

303308

304309
def test_main_exclude_with_bad_table_definition(capsys):
305310
args = ["--exclude", "bogus", ROBOTO_BEFORE_PATH, ROBOTO_AFTER_PATH]
306311

307312
with pytest.raises(SystemExit) as exit_info:
308313
run(args)
309-
captured = capsys.readouterr()
310-
assert captured.error.startswith("[*] ERROR:")
311-
assert exit_info.value.code == 1
314+
315+
captured = capsys.readouterr()
316+
assert captured.err.startswith("[*] ERROR:")
317+
assert exit_info.value.code == 1
312318

313319

314320
def test_main_exclude_with_bad_table_definition_in_multi_table_request(capsys):
315321
args = ["--exclude", "head,bogus", ROBOTO_BEFORE_PATH, ROBOTO_AFTER_PATH]
316322

317323
with pytest.raises(SystemExit) as exit_info:
318324
run(args)
319-
captured = capsys.readouterr()
320-
assert captured.error.startswith("[*] ERROR:")
321-
assert exit_info.value.code == 1
325+
326+
captured = capsys.readouterr()
327+
assert captured.err.startswith("[*] ERROR:")
328+
assert exit_info.value.code == 1
322329

323330

324331
def test_main_head_request(capsys):

0 commit comments

Comments
 (0)