fix: format all code with black
and from now on should not deviate from that...
This commit is contained in:
parent
49f9a0228b
commit
a6bb538ce9
59 changed files with 2762 additions and 2131 deletions
|
@ -8,8 +8,8 @@ from wuttjamaican.problems import ProblemHandler, ProblemCheck
|
|||
|
||||
|
||||
class FakeCheck(ProblemCheck):
|
||||
system_key = 'wuttatest'
|
||||
problem_key = 'fake_check'
|
||||
system_key = "wuttatest"
|
||||
problem_key = "fake_check"
|
||||
title = "Fake problem check"
|
||||
|
||||
|
||||
|
@ -20,18 +20,28 @@ class TestProblems(ConfigTestCase):
|
|||
ctx.parent.wutta_config = self.config
|
||||
|
||||
# nb. avoid printing to console
|
||||
with patch.object(mod.rich, 'print') as rich_print:
|
||||
with patch.object(mod.rich, "print") as rich_print:
|
||||
|
||||
# nb. use fake check
|
||||
with patch.object(ProblemHandler, 'get_all_problem_checks', return_value=[FakeCheck]):
|
||||
with patch.object(
|
||||
ProblemHandler, "get_all_problem_checks", return_value=[FakeCheck]
|
||||
):
|
||||
|
||||
with patch.object(ProblemHandler, 'run_problem_checks') as run_problem_checks:
|
||||
with patch.object(
|
||||
ProblemHandler, "run_problem_checks"
|
||||
) as run_problem_checks:
|
||||
|
||||
# list problem checks
|
||||
orig_organize = ProblemHandler.organize_problem_checks
|
||||
|
||||
def mock_organize(checks):
|
||||
return orig_organize(None, checks)
|
||||
with patch.object(ProblemHandler, 'organize_problem_checks', side_effect=mock_organize) as organize_problem_checks:
|
||||
|
||||
with patch.object(
|
||||
ProblemHandler,
|
||||
"organize_problem_checks",
|
||||
side_effect=mock_organize,
|
||||
) as organize_problem_checks:
|
||||
mod.problems(ctx, list_checks=True)
|
||||
organize_problem_checks.assert_called_once_with([FakeCheck])
|
||||
run_problem_checks.assert_not_called()
|
||||
|
@ -41,10 +51,13 @@ class TestProblems(ConfigTestCase):
|
|||
# nb. just --list for convenience
|
||||
# note that since we also specify invalid --system, no checks will
|
||||
# match and hence nothing significant will be printed to stdout
|
||||
mod.problems(ctx, list_checks=True, systems=['craziness'])
|
||||
mod.problems(ctx, list_checks=True, systems=["craziness"])
|
||||
rich_print.assert_called_once()
|
||||
self.assertEqual(len(rich_print.call_args.args), 1)
|
||||
self.assertIn("No problem reports exist for system", rich_print.call_args.args[0])
|
||||
self.assertIn(
|
||||
"No problem reports exist for system",
|
||||
rich_print.call_args.args[0],
|
||||
)
|
||||
self.assertEqual(len(rich_print.call_args.kwargs), 0)
|
||||
run_problem_checks.assert_not_called()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue