Skip to content

Commit

Permalink
avoid writing out git hash to config yaml so it does not change with …
Browse files Browse the repository at this point in the history
…each test run; note: this is a workaround for better test asset management tracked in #61
  • Loading branch information
ejm714 committed Mar 3, 2025
1 parent d997368 commit 54e9c65
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion tests/assets/experiment/config_artifact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ features_config:
use_sentinel_bands:
- B02
- SCL
last_commit_hash: dbe62790dbdd687953b2faa18465a58baf8a266d
predict_csv: tests/assets/evaluate_data.csv
save_dir: tests/assets/experiment
train_csv: tests/assets/train_data.csv
6 changes: 6 additions & 0 deletions tests/test_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from pydantic import ValidationError
import pytest
from typer.testing import CliRunner
import yaml

from cyfi.config import FeaturesConfig
from cyfi.experiment import app, ExperimentConfig
Expand Down Expand Up @@ -52,3 +53,8 @@ def test_cli_experiment(experiment_config_path):
"results.json",
]:
assert (Path(config.save_dir) / "metrics" / file).exists()

# re-write config to yaml directory without git hash to avoid changing test assets
config = ExperimentConfig.from_file(experiment_config_path)
with (config.save_dir / "config_artifact.yaml").open("w") as fp:
yaml.dump(config.model_dump(exclude={"last_commit_hash"}), fp)

0 comments on commit 54e9c65

Please sign in to comment.