From 0614457b7ba0651f2c61c06268c25b8b6165fee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Sat, 29 Jul 2023 11:57:44 +0800 Subject: [PATCH] Moved dropping tables from the setUp method to the test_init test in the ConsoleCommandTestCase test case. The other tests may not need to drop the tables first. --- tests/test_commands.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_commands.py b/tests/test_commands.py index dc38f81..f09eb5d 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -44,6 +44,11 @@ class ConsoleCommandTestCase(unittest.TestCase): self.__app: Flask = create_test_app() """The Flask application.""" + def test_init(self) -> None: + """Tests the "accounting-init" console command. + + :return: None. + """ with self.__app.app_context(): # Drop every accounting table, to see if accounting-init recreates # them correctly. @@ -58,11 +63,6 @@ class ConsoleCommandTestCase(unittest.TestCase): if x.startswith("accounting_")}), 0) - def test_init(self) -> None: - """Tests the "accounting-init" console command. - - :return: None. - """ runner: FlaskCliRunner = self.__app.test_cli_runner() with self.__app.app_context(): result: Result = runner.invoke(