@@ -176,15 +176,15 @@ def create_olx_validation_artifact(self):
176176
177177 def assert_msg_subject (self , msg ):
178178 """Verify that msg subject is in expected format."""
179- subject = "{platform_name} {studio_name}: Task Status Update" .format (
179+ subject = "{platform_name} {studio_name}: Task Status Update" .format ( # noqa: UP032
180180 platform_name = settings .PLATFORM_NAME , studio_name = settings .STUDIO_NAME
181181 )
182- self .assertEqual (msg .subject , subject )
182+ self .assertEqual (msg .subject , subject ) # noqa: PT009
183183
184184 def assert_msg_body_fragments (self , msg , body_fragments ):
185185 """Verify that email body contains expected fragments"""
186186 for fragment in body_fragments :
187- self .assertIn (fragment , msg .body )
187+ self .assertIn (fragment , msg .body ) # noqa: PT009
188188
189189 def test_email_sent_with_site (self ):
190190 """
@@ -201,7 +201,7 @@ def test_email_sent_with_site(self):
201201 reverse ('usertaskstatus-detail' , args = [self .status .uuid ])
202202 ]
203203
204- self .assertEqual (len (mail .outbox ), 1 )
204+ self .assertEqual (len (mail .outbox ), 1 ) # noqa: PT009
205205
206206 msg = mail .outbox [0 ]
207207
@@ -216,7 +216,7 @@ def test_email_not_sent_with_libary_import_task(self):
216216 end_of_task_status .name = "bulk_migrate_from_modulestore"
217217 user_task_stopped .send (sender = UserTaskStatus , status = end_of_task_status )
218218
219- self .assertEqual (len (mail .outbox ), 0 )
219+ self .assertEqual (len (mail .outbox ), 0 ) # noqa: PT009
220220
221221 def test_email_not_sent_with_libary_content_update (self ):
222222 """
@@ -229,7 +229,7 @@ def test_email_not_sent_with_libary_content_update(self):
229229 end_of_task_status .name = "updating block-v1:course+type@library_content+block@uuid from library"
230230 user_task_stopped .send (sender = UserTaskStatus , status = end_of_task_status )
231231
232- self .assertEqual (len (mail .outbox ), 0 )
232+ self .assertEqual (len (mail .outbox ), 0 ) # noqa: PT009
233233
234234 def test_email_not_sent_with_legacy_libary_content_ref_update (self ):
235235 """
@@ -239,7 +239,7 @@ def test_email_not_sent_with_legacy_libary_content_ref_update(self):
239239 end_of_task_status .name = "Updating legacy library content blocks references of course-v1:UNIX+UN1+2025_T4"
240240 user_task_stopped .send (sender = UserTaskStatus , status = end_of_task_status )
241241
242- self .assertEqual (len (mail .outbox ), 0 )
242+ self .assertEqual (len (mail .outbox ), 0 ) # noqa: PT009
243243
244244 def test_email_sent_with_olx_validations_with_config_enabled (self ):
245245 """
@@ -258,7 +258,7 @@ def test_email_sent_with_olx_validations_with_config_enabled(self):
258258 user_task_stopped .send (sender = UserTaskStatus , status = self .status )
259259 msg = mail .outbox [0 ]
260260
261- self .assertEqual (len (mail .outbox ), 1 )
261+ self .assertEqual (len (mail .outbox ), 1 ) # noqa: PT009
262262 self .assert_msg_subject (msg )
263263 self .assert_msg_body_fragments (msg , body_fragments_with_validation )
264264
@@ -277,8 +277,8 @@ def test_email_sent_with_olx_validations_with_default_config(self):
277277 msg = mail .outbox [0 ]
278278
279279 # Verify olx validation is not enabled out of the box.
280- self .assertFalse (settings .FEATURES .get ('ENABLE_COURSE_OLX_VALIDATION' ))
281- self .assertEqual (len (mail .outbox ), 1 )
280+ self .assertFalse (settings .FEATURES .get ('ENABLE_COURSE_OLX_VALIDATION' )) # noqa: PT009
281+ self .assertEqual (len (mail .outbox ), 1 ) # noqa: PT009
282282 self .assert_msg_subject (msg )
283283 self .assert_msg_body_fragments (msg , body_fragments )
284284
@@ -298,11 +298,11 @@ def test_email_sent_with_olx_validations_with_bypass_flag(self):
298298
299299 user_task_stopped .send (sender = UserTaskStatus , status = self .status )
300300
301- self .assertEqual (len (mail .outbox ), 1 )
301+ self .assertEqual (len (mail .outbox ), 1 ) # noqa: PT009
302302 msg = mail .outbox [0 ]
303303 self .assert_msg_subject (msg )
304304 self .assert_msg_body_fragments (msg , body_fragments )
305- self .assertNotIn ("Here are some validations we found with your course content." , msg .body )
305+ self .assertNotIn ("Here are some validations we found with your course content." , msg .body ) # noqa: PT009
306306
307307 def test_email_not_sent_for_child (self ):
308308 """
@@ -312,7 +312,7 @@ def test_email_not_sent_for_child(self):
312312 user = self .user , task_id = str (uuid4 ()), task_class = 'test_rest_api.sample_task' , name = 'SampleTask 2' ,
313313 total_steps = 5 , parent = self .status )
314314 user_task_stopped .send (sender = UserTaskStatus , status = child_status )
315- self .assertEqual (len (mail .outbox ), 0 )
315+ self .assertEqual (len (mail .outbox ), 0 ) # noqa: PT009
316316
317317 def test_email_sent_without_site (self ):
318318 """
@@ -325,7 +325,7 @@ def test_email_sent_without_site(self):
325325 "Sign in to view the details of your task or download any files created."
326326 ]
327327
328- self .assertEqual (len (mail .outbox ), 1 )
328+ self .assertEqual (len (mail .outbox ), 1 ) # noqa: PT009
329329
330330 msg = mail .outbox [0 ]
331331 self .assert_msg_subject (msg )
@@ -342,7 +342,7 @@ def test_email_retries(self):
342342
343343 with mock .patch ('cms.djangoapps.cms_user_tasks.tasks.send_task_complete_email.retry' ) as mock_retry :
344344 user_task_stopped .send (sender = UserTaskStatus , status = self .status )
345- self .assertTrue (mock_retry .called )
345+ self .assertTrue (mock_retry .called ) # noqa: PT009
346346
347347 def test_queue_email_failure (self ):
348348 logger = logging .getLogger ("cms.djangoapps.cms_user_tasks.signals" )
@@ -354,5 +354,5 @@ def test_queue_email_failure(self):
354354 {'error_response' : 'error occurred' }, {'operation_name' : 'test' }
355355 )
356356 user_task_stopped .send (sender = UserTaskStatus , status = self .status )
357- self .assertTrue (mock_delay .called )
358- self .assertEqual (hdlr .messages ['error' ][0 ], 'Unable to queue send_task_complete_email' )
357+ self .assertTrue (mock_delay .called ) # noqa: PT009
358+ self .assertEqual (hdlr .messages ['error' ][0 ], 'Unable to queue send_task_complete_email' ) # noqa: PT009
0 commit comments