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
				
			
		|  | @ -11,13 +11,13 @@ from wuttjamaican.cli import base as mod | |||
| 
 | ||||
| 
 | ||||
| here = os.path.dirname(__file__) | ||||
| example_conf = os.path.join(here, 'example.conf') | ||||
| example_conf = os.path.join(here, "example.conf") | ||||
| 
 | ||||
| 
 | ||||
| class TestMakeCliConfig(TestCase): | ||||
| 
 | ||||
|     def test_basic(self): | ||||
|         ctx = MagicMock(params={'config_paths': [example_conf]}) | ||||
|         ctx = MagicMock(params={"config_paths": [example_conf]}) | ||||
|         config = mod.make_cli_config(ctx) | ||||
|         self.assertIsInstance(config, WuttaConfig) | ||||
|         self.assertEqual(config.files_read, [example_conf]) | ||||
|  | @ -26,7 +26,7 @@ class TestMakeCliConfig(TestCase): | |||
| class TestTyperCallback(TestCase): | ||||
| 
 | ||||
|     def test_basic(self): | ||||
|         ctx = MagicMock(params={'config_paths': [example_conf]}) | ||||
|         ctx = MagicMock(params={"config_paths": [example_conf]}) | ||||
|         mod.typer_callback(ctx) | ||||
|         self.assertIsInstance(ctx.wutta_config, WuttaConfig) | ||||
|         self.assertEqual(ctx.wutta_config.files_read, [example_conf]) | ||||
|  | @ -35,10 +35,10 @@ class TestTyperCallback(TestCase): | |||
| class TestTyperEagerImports(TestCase): | ||||
| 
 | ||||
|     def test_basic(self): | ||||
|         typr = mod.make_typer(name='foobreezy') | ||||
|         with patch.object(mod, 'load_entry_points') as load_entry_points: | ||||
|         typr = mod.make_typer(name="foobreezy") | ||||
|         with patch.object(mod, "load_entry_points") as load_entry_points: | ||||
|             mod.typer_eager_imports(typr) | ||||
|             load_entry_points.assert_called_once_with('foobreezy.typer_imports') | ||||
|             load_entry_points.assert_called_once_with("foobreezy.typer_imports") | ||||
| 
 | ||||
| 
 | ||||
| class TestMakeTyper(TestCase): | ||||
|  |  | |||
|  | @ -9,17 +9,16 @@ from wuttjamaican.app import AppHandler | |||
| 
 | ||||
| 
 | ||||
| here = os.path.dirname(__file__) | ||||
| example_conf = os.path.join(here, 'example.conf') | ||||
| example_conf = os.path.join(here, "example.conf") | ||||
| 
 | ||||
| 
 | ||||
| class TestMakeAppdir(ConfigTestCase): | ||||
| 
 | ||||
|     def test_basic(self): | ||||
|         appdir = os.path.join(self.tempdir, 'app') | ||||
|         ctx = MagicMock(params={'config_paths': [example_conf], | ||||
|                                 'appdir_path': appdir}) | ||||
|         appdir = os.path.join(self.tempdir, "app") | ||||
|         ctx = MagicMock(params={"config_paths": [example_conf], "appdir_path": appdir}) | ||||
|         ctx.parent.wutta_config = self.config | ||||
| 
 | ||||
|         with patch.object(AppHandler, 'make_appdir') as make_appdir: | ||||
|         with patch.object(AppHandler, "make_appdir") as make_appdir: | ||||
|             mod.make_appdir(ctx) | ||||
|             make_appdir.assert_called_once_with(appdir) | ||||
|  |  | |||
|  | @ -8,13 +8,13 @@ from wuttjamaican.cli import make_uuid as mod | |||
| 
 | ||||
| 
 | ||||
| here = os.path.dirname(__file__) | ||||
| example_conf = os.path.join(here, 'example.conf') | ||||
| example_conf = os.path.join(here, "example.conf") | ||||
| 
 | ||||
| 
 | ||||
| class TestMakeUuid(TestCase): | ||||
| 
 | ||||
|     def test_basic(self): | ||||
|         ctx = MagicMock(params={'config_paths': [example_conf]}) | ||||
|         with patch.object(mod, 'sys') as sys: | ||||
|         ctx = MagicMock(params={"config_paths": [example_conf]}) | ||||
|         with patch.object(mod, "sys") as sys: | ||||
|             mod.make_uuid(ctx) | ||||
|             sys.stdout.write.assert_called_once() | ||||
|  |  | |||
|  | @ -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