Skip to content

Commit

Permalink
test: update tests with new functions from ccbr_tools
Browse files Browse the repository at this point in the history
  • Loading branch information
kelly-sovacool committed Aug 13, 2024
1 parent 58d3d10 commit 295e334
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion tests/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os.path
import subprocess

from renee.src.renee.cache import get_sif_cache_dir, get_singularity_cachedir
from ccbr_tools.pipeline.cache import get_sif_cache_dir, get_singularity_cachedir

renee_run = (
"./bin/renee run "
Expand Down
19 changes: 10 additions & 9 deletions tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,26 @@
import os
import tempfile

from renee.src.renee.util import (
from ccbr_tools.pipeline.util import (
get_tmp_dir,
get_shared_resources_dir,
renee_base,
get_hpcname,
)
from renee.src.renee.cache import get_sif_cache_dir
from renee.src.renee.run import run, run_in_context
from renee.src.renee.util import get_hpcname
from ccbr_tools.pipeline.cache import get_sif_cache_dir
from ccbr_tools.shell import exec_in_context

from renee.src.renee.util import renee_base
from renee.src.renee.run import run


def test_dryrun():
if get_hpcname() == "biowulf":
with tempfile.TemporaryDirectory() as tmp_dir:
run_args = argparse.Namespace(
input=list(glob.glob(os.path.join(renee_base(".tests"), "*.fastq.gz"))),
input=list(glob.glob(renee_base(".tests", "*.fastq.gz"))),
output=tmp_dir,
genome=os.path.join(
renee_base("config"), "genomes", "biowulf", "hg38_36.json"
),
genome=renee_base("config", "genomes", "biowulf", "hg38_36.json"),
mode="slurm",
runmode="run",
dry_run=True,
Expand All @@ -36,7 +37,7 @@ def test_dryrun():
threads=2,
)
# execute dry run and capture stdout/stderr
allout = run_in_context(run_args)
allout = exec_in_context(run, run_args)
assert (
"This was a dry-run (flag -n). The order of jobs does not reflect the order of execution."
in allout
Expand Down
13 changes: 8 additions & 5 deletions tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
import tempfile
import warnings

from renee.src.renee.util import (
renee_base,
from ccbr_tools.pipeline.util import (
_cp_r_safe_,
get_genomes_dict,
get_genomes_list,
)

from renee.src.renee.util import renee_base


def test_renee_base():
renee_bin = renee_base(os.path.join("bin", "renee"))
Expand Down Expand Up @@ -52,7 +53,7 @@ def test_cp_unsafe():

def test_get_genomes_warnings():
with warnings.catch_warnings(record=True) as raised_warnings:
genomes = get_genomes_list(hpcname="notAnOption")
genomes = get_genomes_list(repo_base=renee_base, hpcname="notAnOption")
assertions = [
"len(genomes) == 0",
"len(raised_warnings) == 2",
Expand All @@ -68,10 +69,12 @@ def test_get_genomes_warnings():

def test_get_genomes_error():
with pytest.raises(UserWarning) as exception_info:
get_genomes_list(hpcname="notAnOption", error_on_warnings=True)
get_genomes_list(
repo_base=renee_base, hpcname="notAnOption", error_on_warnings=True
)
assert "Folder does not exist" in str(exception_info.value)


def test_get_genomes_biowulf():
genomes_dict = get_genomes_dict(hpcname="biowulf")
genomes_dict = get_genomes_dict(repo_base=renee_base, hpcname="biowulf")
assert len(genomes_dict) > 10

0 comments on commit 295e334

Please sign in to comment.