Skip to content

Commit

Permalink
fix: display wrapper or external script code in report #1393 (#1404)
Browse files Browse the repository at this point in the history
* Remove the decode attributes of source files fix #1393

* Adding a test with report generation without md5sum check

* Formatting with black

* feat: Adding --cluster-cancel and --cluster-cancel-nargs (#1395)

* Adding support for --cluster-[m]cancel

* Adding support for --cluster-[m]cancel.

* Adressing points from code review

* [ci skip] fix typos

Co-authored-by: Johannes Köster <johannes.koester@uni-due.de>

Co-authored-by: Johannes Köster <johannes.koester@tu-dortmund.de>
Co-authored-by: Manuel Holtgrewe <manuel.holtgrewe@bihealth.de>
Co-authored-by: Johannes Köster <johannes.koester@uni-due.de>
  • Loading branch information
4 people committed Feb 18, 2022
1 parent e1cbde5 commit a007bd1
Show file tree
Hide file tree
Showing 5 changed files with 1,585 additions and 2 deletions.
4 changes: 2 additions & 2 deletions snakemake/report/__init__.py
Expand Up @@ -263,7 +263,7 @@ def code(self):
_, source, language, _ = script.get_source(
self._rule.script, self._rule.workflow.sourcecache, self._rule.basedir
)
sources = [source.decode()]
sources = [source]
elif self._rule.wrapper is not None and not contains_wildcard(
self._rule.wrapper
):
Expand All @@ -276,7 +276,7 @@ def code(self):
),
self._rule.workflow.sourcecache,
)
sources = [source.decode()]
sources = [source]
elif self._rule.notebook is not None and not contains_wildcard(
self._rule.notebook
):
Expand Down
30 changes: 30 additions & 0 deletions tests/test_report_display_code/Snakefile
@@ -0,0 +1,30 @@
rule all:
input:
"test.vcf.gz",


rule a:
output:
"{prefix}.txt",
shell:
"touch {output}"


rule b:
input:
"{prefix}.txt",
output:
"{prefix}.vcf",
script:
"test.py"


rule bgzip:
input:
"{prefix}.vcf",
output:
"{prefix}.vcf.gz",
log:
"logs/bgzip/{prefix}.log",
wrapper:
"v1.1.0/bio/bgzip"
1,543 changes: 1,543 additions & 0 deletions tests/test_report_display_code/expected-results/report.html

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions tests/test_report_display_code/test.py
@@ -0,0 +1,2 @@
with open(snakemake.output[0], "w") as f:
f.write("bar")
8 changes: 8 additions & 0 deletions tests/tests.py
Expand Up @@ -229,6 +229,14 @@ def test_report_dir():
run(dpath("test_report_dir"), report="report.zip", check_md5=False)


def test_report_display_code():
run(
dpath("test_report_display_code"),
report="report.html",
check_md5=False,
)


def test_dynamic():
run(dpath("test_dynamic"))

Expand Down

0 comments on commit a007bd1

Please sign in to comment.