Skip to content

Commit c1e86fb

Browse files
Fix unreachable assertions in test_errors_only and test_verbose test method #10450 (#10509)
1 parent a52dd58 commit c1e86fb

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

tests/test_self.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,9 +1625,8 @@ def test_generate_toml_config_disable_symbolic_names() -> None:
16251625
@staticmethod
16261626
def test_errors_only() -> None:
16271627
"""Test the --errors-only flag."""
1628-
with pytest.raises(SystemExit):
1629-
run = Run(["--errors-only"])
1630-
assert run.linter._error_mode
1628+
run = Run([str(UNNECESSARY_LAMBDA), "--errors-only"], exit=False)
1629+
assert run.linter._error_mode
16311630

16321631
@staticmethod
16331632
def test_errors_only_functions_as_disable() -> None:
@@ -1643,13 +1642,8 @@ def test_errors_only_functions_as_disable() -> None:
16431642
@staticmethod
16441643
def test_verbose() -> None:
16451644
"""Test the --verbose flag."""
1646-
with pytest.raises(SystemExit):
1647-
run = Run(["--verbose"])
1648-
assert run.verbose
1649-
1650-
with pytest.raises(SystemExit):
1651-
run = Run(["--verbose=True"])
1652-
assert run.verbose
1645+
run = Run([str(UNNECESSARY_LAMBDA), "--verbose"], exit=False)
1646+
assert run.verbose
16531647

16541648
@staticmethod
16551649
def test_enable_all_extensions() -> None:

0 commit comments

Comments
 (0)