Skip to content

Commit

Permalink
fix: R encoding of pathlib.Path objects (#1201)
Browse files Browse the repository at this point in the history
* feat: support converting Path objects for R

* test: test for converting Path objects to R

* Update script.py

* test: Snakemake test for R encoding pathlib.Path objects (missing files)

* fix: touch file to make expected-results dir appear in git

Co-authored-by: Johannes Köster <johannes.koester@uni-due.de>
  • Loading branch information
jhrcook and johanneskoester committed Nov 23, 2021
1 parent 12a9f92 commit bd516e9
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_converting_path_for_r_script/Snakefile
@@ -0,0 +1,18 @@

from pathlib import Path


rule all:
input:
out_file="out-file.txt"


rule step1:
input:
text_file=Path("text-file.txt")
params:
param_dir=Path("dir")
output:
out_file=Path("out-file.txt")
script:
"r-script.R"
Empty file.
9 changes: 9 additions & 0 deletions tests/test_converting_path_for_r_script/r-script.R
@@ -0,0 +1,9 @@

infile <- snakemake@input[["text_file"]]

# Check the read value is as expected in R.
param_dir <- snakemake@params[["param_dir"]]
stopifnot(param_dir == "dir")

outfile <- snakemake@output[["out_file"]]
file.create(outfile)
Empty file.
4 changes: 4 additions & 0 deletions tests/tests.py
Expand Up @@ -1340,5 +1340,9 @@ def test_github_issue1158():
)


def test_converting_path_for_r_script():
run(dpath("test_converting_path_for_r_script"), cores=1)


def test_ancient_dag():
run(dpath("test_ancient_dag"))

0 comments on commit bd516e9

Please sign in to comment.