diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 17f032a..1d7b788 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -5,16 +5,7 @@ # - Update some actions to more recent versions name: release -on: - push: - branches: - # Run tests for change on the main branch ... - - main - tags-ignore: - # ... but not for tags (avoids duplicate work). - - '**' - pull_request: - # Run tests on pull requests +on: push env: # This is not critical diff --git a/stepup/core/workflow.py b/stepup/core/workflow.py index cc0c198..e38845c 100644 --- a/stepup/core/workflow.py +++ b/stepup/core/workflow.py @@ -513,7 +513,6 @@ def filter_deferred(self, paths: list[str]) -> list[str]: all_paths = [] while not (path is None or f"file:{path}" in self.nodes): all_paths.insert(0, path) - print(all_paths) path = myparent(path) for path_up in all_paths: dg = self.matching_deferred_glob(path_up) diff --git a/tests/test_workflow.py b/tests/test_workflow.py index 7f41438..236afaf 100644 --- a/tests/test_workflow.py +++ b/tests/test_workflow.py @@ -1650,3 +1650,50 @@ def test_set_pool(wfp): plan.update_recording(wfp) assert plan.recording.defined_pools == {"random": 2} check_workflow_unstructure(wfp) + + +def test_filter_deferred1(wfp): + plan_key = "step:./plan.py" + assert wfp.defer_glob(plan_key, ["*.txt"]) == [] + assert wfp.filter_deferred(["test.png", "test.txt", "other.txt", "sub/boom.txt"]) == [ + "test.txt", + "other.txt", + ] + assert "file:test.png" not in wfp.nodes + assert wfp.get_file("file:test.txt").get_state(wfp) == FileState.MISSING + assert wfp.get_file("file:other.txt").get_state(wfp) == FileState.MISSING + assert "file:sub/boom.txt" not in wfp.nodes + + +def test_filter_deferred2(wfp): + plan_key = "step:./plan.py" + assert wfp.defer_glob(plan_key, ["data/**"]) == [] + assert wfp.filter_deferred(["data/test.txt", "data.txt"]) == ["data/", "data/test.txt"] + assert wfp.get_file("file:data/").get_state(wfp) == FileState.MISSING + assert wfp.get_file("file:data/test.txt").get_state(wfp) == FileState.MISSING + assert "file:data.txt" not in wfp.nodes + + +def test_filter_deferred3(wfp): + plan_key = "step:./plan.py" + assert wfp.defer_glob(plan_key, ["data/**/foo.txt"]) == [] + with pytest.raises(GraphError): + wfp.filter_deferred(["data/test/foo.txt"]) + wfp.declare_static(plan_key, ["data/", "data/other/"]) + assert wfp.filter_deferred(["data/other/foo.txt"]) == ["data/other/foo.txt"] + + +def test_confirm_deferred(wfp): + plan_key = "step:./plan.py" + step_key = wfp.define_step(plan_key, "cat ${inp}", inp_paths=["test.txt"]) + wfp.declare_static(plan_key, ["test.txt", "other.txt"], verified=False) + # static other.txt + assert wfp.get_file("file:other.txt").get_state(wfp) == FileState.MISSING + wfp.confirm_deferred(["other.txt"]) + assert wfp.get_step(step_key).get_state(wfp) == StepState.PENDING + # static test.txt + assert wfp.get_file("file:test.txt").get_state(wfp) == FileState.MISSING + assert wfp.get_step(step_key).get_state(wfp) == StepState.PENDING + wfp.confirm_deferred(["test.txt"]) + assert wfp.get_file("file:test.txt").get_state(wfp) == FileState.STATIC + assert wfp.get_step(step_key).get_state(wfp) == StepState.QUEUED