-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
113 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from sirocco import pretty_print | ||
from sirocco.core import workflow | ||
from sirocco.parsing import _yaml_data_models as models | ||
|
||
|
||
def test_minimal_workflow(): | ||
minimal_config = models.ConfigWorkflow( | ||
cycles=[], | ||
tasks=[{"some_task": {"plugin": "shell"}}], | ||
data=models.ConfigData( | ||
available=[models.ConfigAvailableData(foo={})], | ||
generated=[models.ConfigGeneratedData(bar={})], | ||
), | ||
) | ||
|
||
testee = workflow.Workflow(minimal_config) | ||
|
||
pretty_print.PrettyPrinter().format(testee) | ||
|
||
assert testee.name is None | ||
assert len(list(testee.tasks)) == 0 | ||
assert len(list(testee.cycles)) == 0 | ||
assert testee.data[("foo", {})].available |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import textwrap | ||
|
||
from sirocco.parsing import _yaml_data_models as models | ||
|
||
|
||
def test_workflow_test_internal_dicts(): | ||
testee = models.ConfigWorkflow( | ||
cycles=[], | ||
tasks=[{"some_task": {"plugin": "shell"}}], | ||
data=models.ConfigData( | ||
available=[models.ConfigAvailableData(foo={})], | ||
generated=[models.ConfigGeneratedData(bar={})], | ||
), | ||
) | ||
assert testee.data_dict["foo"].name == "foo" | ||
assert testee.data_dict["bar"].name == "bar" | ||
assert testee.task_dict["some_task"].name == "some_task" | ||
|
||
|
||
def test_load_workflow_config(tmp_path): | ||
minimal_config = textwrap.dedent( | ||
""" | ||
cycles: | ||
- minimal: | ||
tasks: | ||
- a: | ||
tasks: | ||
- b: | ||
plugin: shell | ||
data: | ||
available: | ||
- c: | ||
generated: | ||
- d: | ||
""" | ||
) | ||
minimal = tmp_path / "minimal.yml" | ||
minimal.write_text(minimal_config) | ||
testee = models.load_workflow_config(str(minimal)) | ||
assert testee.name == "minimal" | ||
assert testee.rootdir == tmp_path |