Skip to content

Commit 6379737

Browse files
Using the Lightning CLI interface to run tests
Signed-off-by: João Lucas de Sousa Almeida <[email protected]>
1 parent 1ebeeb5 commit 6379737

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

tests/test_finetune.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
import subprocess
77
import os
88

9-
from terratorch.models.backbones.prithvi_vit import checkpoint_filter_fn as checkpoint_filter_fn_vit
10-
from terratorch.models.backbones.prithvi_swin import checkpoint_filter_fn as checkpoint_filter_fn_swin
9+
from terratorch.cli_tools import build_lightning_cli
1110

1211
@pytest.mark.parametrize("model_name", ["prithvi_swin_B", "prithvi_swin_L", "prithvi_vit_100", "prithvi_vit_300"])
1312
def test_finetune_multiple_backbones(model_name):
@@ -21,11 +20,7 @@ def test_finetune_multiple_backbones(model_name):
2120
torch.save(state_dict, os.path.join("tests/", model_name + ".pt"))
2221

2322
# Running the terratorch CLI
24-
command_str = f"terratorch fit -c tests/manufactured-finetune_{model_name}.yaml"
25-
26-
command_out = subprocess.run(command_str, shell=True)
27-
28-
assert not command_out.returncode
29-
23+
command_list = ["fit", "-c", f"tests/manufactured-finetune_{model_name}.yaml"]
24+
_ = build_lightning_cli(command_list)
3025

3126

0 commit comments

Comments
 (0)