Skip to content

Commit f199303

Browse files
committed
using monkeypatch to test predict_step
1 parent 3a8896a commit f199303

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

tests/trainers/test_change.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ def test_trainer(
5353
config = os.path.join('tests', 'conf', name + '.yaml')
5454

5555
monkeypatch.setattr(smp, 'Unet', create_model)
56+
monkeypatch.setattr(
57+
OSCDDataModule, 'predict_dataloader', OSCDDataModule.test_dataloader
58+
)
5659

5760
args = [
5861
'--config',

torchgeo/datamodules/oscd.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ def setup(self, stage: str) -> None:
108108
Args:
109109
stage: Either 'fit', 'validate', 'test', or 'predict'.
110110
"""
111-
self.dataset = OSCD(split='test', **self.kwargs)
112111
if stage in ['fit', 'validate']:
113112
self.dataset = OSCD(split='train', **self.kwargs)
114113
generator = torch.Generator().manual_seed(0)

0 commit comments

Comments
 (0)