Skip to content

Commit

Permalink
TST: add tests for graphbin, fixes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
KatherineCaley committed Aug 31, 2024
1 parent 2223156 commit cc3d872
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion tests/test_cli_graphbin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

DATADIR = pathlib.Path(__file__).parent / "data"


@pytest.fixture(scope="session")
def tmp_dir(tmpdir_factory):
return tmpdir_factory.mktemp("tmp")
Expand All @@ -29,7 +30,7 @@ def runner():
return CliRunner()


def test_graphbin_run(runner, tmp_dir):
def test_graphbin_spades_run(runner, tmp_dir):
outpath = tmp_dir
graph = DATADIR / "5G_metaSPAdes" / "assembly_graph_with_scaffolds.gfa"
contigs = DATADIR / "5G_metaSPAdes" / "contigs.fasta"
Expand All @@ -38,3 +39,24 @@ def test_graphbin_run(runner, tmp_dir):
args = f"--assembler spades --graph {graph} --contigs {contigs} --paths {paths} --binned {binned} --output {outpath}".split()
r = runner.invoke(graphbin, args, catch_exceptions=False)
assert r.exit_code == 0, r.output


def test_graphbin_megahit_run(runner, tmp_dir):
outpath = tmp_dir
graph = DATADIR / "5G_MEGAHIT" / "final.gfa"
contigs = DATADIR / "5G_MEGAHIT" / "final.contigs.fa"
binned = DATADIR / "5G_MEGAHIT" / "initial_contig_bins.csv"
args = f"--assembler megahit --graph {graph} --contigs {contigs} --binned {binned} --output {outpath}".split()
r = runner.invoke(graphbin, args, catch_exceptions=False)
assert r.exit_code == 0, r.output


def test_graphbin_flye_run(runner, tmp_dir):
outpath = tmp_dir
graph = DATADIR / "1Y3B_Flye" / "assembly_graph.gfa"
contigs = DATADIR / "1Y3B_Flye" / "assembly.fasta"
paths = DATADIR / "1Y3B_Flye" / "assembly_info.txt"
binned = DATADIR / "1Y3B_Flye" / "initial_contig_bins.csv"
args = f"--assembler flye --graph {graph} --contigs {contigs} --paths {paths} --binned {binned} --output {outpath}".split()
r = runner.invoke(graphbin, args, catch_exceptions=False)
assert r.exit_code == 0, r.output

0 comments on commit cc3d872

Please sign in to comment.