Fix flaky test caused by weak reference (#14157)

This commit is contained in:
Carlos Mocholí 2022-08-11 09:33:19 +02:00 committed by GitHub
parent a7cebf2416
commit 3dc08b1ef5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -445,7 +445,8 @@ def test_dataloader_source_direct_access():
def test_dataloader_source_request_from_module():
"""Test requesting a dataloader from a module works."""
module = BoringModel()
module.trainer = Trainer()
trainer = Trainer()
module.trainer = trainer
module.foo = Mock(return_value=module.train_dataloader())
source = _DataLoaderSource(module, "foo")