diff --git a/snakemake/workflow.py b/snakemake/workflow.py index 97296c46d..c89d69033 100644 --- a/snakemake/workflow.py +++ b/snakemake/workflow.py @@ -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 diff --git a/tests/testapi.py b/tests/testapi.py index 12400bc8d..ef6e2d13a 100644 --- a/tests/testapi.py +++ b/tests/testapi.py @@ -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")