@@ -104,26 +104,36 @@ def test_task_runner__single_database___consumes_tasks_from_one_databases(
104104 ],
105105)
106106@pytest .mark .parametrize (
107- "setup" ,
107+ "setup, expected_error " ,
108108 [
109- { # Missing router and database
110- "DATABASE_ROUTERS" : [],
111- "DATABASES" : {"default" : "exists but not task processor" },
112- },
113- { # Missing database
114- "DATABASE_ROUTERS" : ["task_processor.routers.TaskProcessorRouter" ],
115- "DATABASES" : {"default" : "exists but not task processor" },
116- },
117- { # Missing router
118- "DATABASE_ROUTERS" : [],
119- "DATABASES" : {
120- "default" : "hooray" ,
121- "task_processor" : "exists" ,
109+ (
110+ { # Missing router and database
111+ "DATABASE_ROUTERS" : [],
112+ "DATABASES" : {"default" : "exists but not task processor" },
122113 },
123- },
114+ "DATABASE_ROUTERS must include 'task_processor.routers.TaskProcessorRouter' when using a separate task processor database." ,
115+ ),
116+ (
117+ { # Missing router
118+ "DATABASE_ROUTERS" : [],
119+ "DATABASES" : {
120+ "default" : "hooray" ,
121+ "task_processor" : "exists" ,
122+ },
123+ },
124+ "DATABASE_ROUTERS must include 'task_processor.routers.TaskProcessorRouter' when using a separate task processor database." ,
125+ ),
126+ (
127+ { # Missing database
128+ "DATABASE_ROUTERS" : ["task_processor.routers.TaskProcessorRouter" ],
129+ "DATABASES" : {"default" : "exists but not task processor" },
130+ },
131+ "DATABASES must include 'task_processor' when using a separate task processor database." ,
132+ ),
124133 ],
125134)
126135def test_validates_django_settings_are_compatible_with_multi_database_setup (
136+ expected_error : str ,
127137 mocker : MockerFixture ,
128138 settings : SettingsWrapper ,
129139 setup : dict [str , typing .Any ],
@@ -140,7 +150,4 @@ def test_validates_django_settings_are_compatible_with_multi_database_setup(
140150 threads .TaskRunner .run_iteration (task_runner )
141151
142152 # Then
143- assert str (excinfo .value ) in [
144- "DATABASE_ROUTERS must include 'task_processor.routers.TaskProcessorRouter' when using a separate task processor database." ,
145- "DATABASES must include 'task_processor' when using a separate task processor database." ,
146- ]
153+ assert str (excinfo .value ) == expected_error
0 commit comments