Skip to content

Commit

Permalink
Merge pull request #3 from sunbeam-labs/2-get-testing-working
Browse files Browse the repository at this point in the history
Add dryrun test
  • Loading branch information
Ulthran authored Feb 4, 2025
2 parents 4860cea + e4d0cdc commit abfa081
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 11 deletions.
51 changes: 41 additions & 10 deletions .tests/e2e/test_full_run.py → .tests/e2e/test_dry_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,38 @@ def setup():

config_fp = project_dir / "sunbeam_config.yml"

config_str = f"sbx_sga: {{example_rule_options: '--number'}}"
config_str = f"sbx_sga: {{mash_ref: '{temp_dir}/dummy.msh'}}"
Path(temp_dir / "dummy.msh").touch()

sp.check_output(
[
"sunbeam",
"config",
"modify",
"-i",
"-s",
f"{config_str}",
f"{config_fp}",
]
)

config_str = f"sbx_sga: {{checkm_ref: '{temp_dir}/dummy.1.dmnd'}}"
Path(temp_dir / "dummy.1.dmnd").touch()

sp.check_output(
[
"sunbeam",
"config",
"modify",
"-i",
"-s",
f"{config_str}",
f"{config_fp}",
]
)

config_str = f"sbx_sga: {{bakta_ref: '{temp_dir}/bakta/db/'}}"
Path(temp_dir / "bakta/db/").mkdir(parents=True, exist_ok=True)

sp.check_output(
[
Expand Down Expand Up @@ -52,29 +83,29 @@ def run_sunbeam(setup):
"run",
"--profile",
project_dir,
"all_template",
"all_sga",
"--directory",
temp_dir,
"-n",
]
)
except sp.CalledProcessError as e:
shutil.copytree(log_fp, "logs/")
shutil.copytree(stats_fp, "stats/")
sys.exit(e)

shutil.copytree(log_fp, "logs/")
shutil.copytree(stats_fp, "stats/")
# shutil.copytree(log_fp, "logs/")
# shutil.copytree(stats_fp, "stats/")
Path("logs/").mkdir(parents=True, exist_ok=True)
Path("stats/").mkdir(parents=True, exist_ok=True)
Path("logs/file").touch()
Path("stats/file").touch()

output_fp = project_dir / "sunbeam_output"
benchmarks_fp = project_dir / "stats/"

yield output_fp, benchmarks_fp


def test_full_run(run_sunbeam):
def test_dry_run(run_sunbeam):
output_fp, benchmarks_fp = run_sunbeam

big_file_fp = output_fp / "qc/mush/big_file.txt"

# Check output
assert big_file_fp.exists(), f"{big_file_fp} does not exist"
1 change: 0 additions & 1 deletion sbx_sga.smk
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ localrules:
rule all_sga:
input:
# QC
#expand(ISOLATE_FP / "fastqc" / "{sample}_{rp}_fastqc/fastqc_data.txt", rp=Pairs, sample=Samples),
expand(ISOLATE_FP / "mash" / "{sample}_sorted_winning.tab", sample=Samples),
# Assembly QC
ISOLATE_FP / "checkm" / "quality_report.tsv",
Expand Down

0 comments on commit abfa081

Please sign in to comment.