Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: None type error when invoking Workflow object manually #1731

Merged
merged 3 commits into from Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion snakemake/workflow.py
Expand Up @@ -165,7 +165,9 @@ def __init__(
self.global_resources["_cores"] = cores
self.global_resources["_nodes"] = nodes

self.rerun_triggers = frozenset(rerun_triggers)
self.rerun_triggers = (
frozenset(rerun_triggers) if rerun_triggers is not None else frozenset()
)
self._rules = OrderedDict()
self.default_target = None
self._workdir = None
Expand Down
22 changes: 22 additions & 0 deletions tests/testapi.py
Expand Up @@ -17,6 +17,28 @@ def test_keep_logger():
snakemake(path, workdir=tmpdir, keep_logger=True)


def test_workflow_calling():
with tempfile.TemporaryDirectory() as tmpdir:
path = os.path.join(tmpdir, "Snakefile")
with open(path, "w") as f:
print(
dedent(
"""
rule:
output: 'result.txt'
run:
with open(output[0], 'w') as f:
print("hello", file=f)
"""
),
file=f,
)
workflow = Workflow(
snakefile=snakefile,
overwrite_workdir=tmpdir,
)


def test_run_script_directive():
with tempfile.TemporaryDirectory() as tmpdir:
path = os.path.join(tmpdir, "Snakefile")
Expand Down