File tree Expand file tree Collapse file tree
crates/hm-dsl-engine/harmont-py Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -743,7 +743,9 @@ def _make_rust_project(
743743 components = components ,
744744 base = base ,
745745 )
746-
746+ # set empty file path to "." to prevent root-relative from happening
747+ if not path :
748+ path = "."
747749 lock_path = f"{ path } /Cargo.lock" if path != "." else "Cargo.lock"
748750 toml_glob = f"{ path } /**/Cargo.toml" if path != "." else "**/Cargo.toml"
749751 rs_glob = f"{ path } /**/*.rs" if path != "." else "**/*.rs"
Original file line number Diff line number Diff line change 33from __future__ import annotations
44
55import pytest
6+ import tempfile
67
78import harmont as hm
89from harmont .cache import CacheOnChange
10+ from harmont .keygen import resolve_pipeline_keys
11+ from pathlib import Path
12+
913
1014
1115def _cmds (p : dict ) -> list [str ]:
@@ -328,6 +332,36 @@ def test_project_has_all_methods(self):
328332 assert proj .clippy ().cmd is not None
329333 assert proj .fmt ().cmd is not None
330334
335+
336+ def test_empty_path_throws_error_is_caught (self ):
337+ proj = hm .rust .project (path = "" )
338+ graph = {
339+ "nodes" : [
340+ {
341+ "step" : {
342+ "key" : "a" ,
343+ "cmd" : "cargo build" ,
344+ "cache" : {"policy" : "on_change" , "paths" : [p for p in list (proj .warmup .cache .paths )]},
345+ },
346+ "env" : {},
347+ },
348+ ],
349+ "node_holes" : [],
350+ "edge_property" : "directed" ,
351+ "edges" : [],
352+ }
353+
354+ with tempfile .TemporaryDirectory () as d :
355+ res = resolve_pipeline_keys (
356+ graph ,
357+ pipeline_org = "default" ,
358+ pipeline_slug = "default" ,
359+ now = 0 ,
360+ base_path = Path (d ),
361+ env = {}
362+ )
363+ assert res ['nodes' ][0 ]['step' ]['cache' ]['key' ] is not None
364+
331365 def test_warmup_implicit_cache_on_change (self ):
332366 proj = hm .rust .project (path = "cli" )
333367 assert proj .warmup .cache == CacheOnChange (
You can’t perform that action at this time.
0 commit comments