@@ -212,6 +212,53 @@ def test_v1_5_0_model_checkpoint_period(tmpdir):
212212 ModelCheckpoint (dirpath = tmpdir , period = 1 )
213213
214214
215+ def test_v1_5_0_old_on_train_epoch_end (tmpdir ):
216+ callback_warning_cache .clear ()
217+
218+ class OldSignature (Callback ):
219+
220+ def on_train_epoch_end (self , trainer , pl_module , outputs ): # noqa
221+ ...
222+
223+ class OldSignatureModel (BoringModel ):
224+
225+ def on_train_epoch_end (self , outputs ): # noqa
226+ ...
227+
228+ model = BoringModel ()
229+ trainer = Trainer (default_root_dir = tmpdir , max_epochs = 1 , callbacks = OldSignature ())
230+
231+ with pytest .deprecated_call (match = "old signature will be removed in v1.5" ):
232+ trainer .fit (model )
233+
234+ callback_warning_cache .clear ()
235+
236+ model = OldSignatureModel ()
237+
238+ with pytest .deprecated_call (match = "old signature will be removed in v1.5" ):
239+ trainer .fit (model )
240+
241+ trainer .train_loop .warning_cache .clear ()
242+
243+ class NewSignature (Callback ):
244+
245+ def on_train_epoch_end (self , trainer , pl_module ):
246+ ...
247+
248+ trainer .callbacks = [NewSignature ()]
249+ with no_deprecated_call (match = "`Callback.on_train_epoch_end` signature has changed in v1.3." ):
250+ trainer .fit (model )
251+
252+ class NewSignatureModel (BoringModel ):
253+
254+ def on_train_epoch_end (self ):
255+ ...
256+
257+ model = NewSignatureModel ()
258+ with no_deprecated_call (match = "`ModelHooks.on_train_epoch_end` signature has changed in v1.3." ):
259+ trainer .fit (model )
260+
261+
215262@pytest .mark .parametrize ("cls" , (BaseProfiler , SimpleProfiler , AdvancedProfiler , PyTorchProfiler ))
216263def test_v1_5_0_profiler_output_filename (tmpdir , cls ):
217264 filepath = str (tmpdir / "test.txt" )
0 commit comments