-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
5 changed files
with
56 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[run] | ||
branch = True | ||
source = cwl_utils | ||
|
||
[report] | ||
exclude_lines = | ||
if self.debug: | ||
pragma: no cover | ||
raise NotImplementedError | ||
if __name__ == .__main__.: | ||
ignore_errors = True | ||
omit = | ||
tests/* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tests/load_cwl_by_path.py |
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,20 @@ | ||
"""This is the example from README.md, please synchronize all changes between the two.""" | ||
# SPDX-License-Identifier: Apache-2.0 | ||
from pathlib import Path | ||
from ruamel import yaml | ||
import sys | ||
|
||
from cwl_utils.parser import load_document_by_path, save | ||
|
||
# File Input - This is the only thing you will need to adjust or take in as an input to your function: | ||
cwl_file = Path("testdata/md5sum.cwl") # or a plain string works as well | ||
|
||
# Import CWL Object | ||
cwl_obj = load_document_by_path(cwl_file) | ||
|
||
# View CWL Object | ||
print("List of object attributes:\n{}".format("\n".join(map(str, dir(cwl_obj))))) | ||
|
||
# Export CWL Object into a built-in typed object | ||
saved_obj = save(cwl_obj) | ||
print(f"Export of the loaded CWL object: {saved_obj}.") |
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,18 @@ | ||
"""Tests of example Python scripts.""" | ||
import os | ||
from pathlib import Path | ||
|
||
|
||
def test_load_example() -> None: | ||
"""Test the load_cwl_by_path.py script.""" | ||
cwd = Path.cwd() | ||
parent = Path(__file__).resolve().parent | ||
os.chdir(parent.parent) | ||
exec( | ||
open(parent / "load_cwl_by_path.py").read(), | ||
globals(), | ||
locals(), | ||
) | ||
os.chdir(cwd) | ||
result = locals()["saved_obj"] | ||
assert result["class"] == "Workflow" |