Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
uniqueg committed Jan 31, 2024
1 parent 1602906 commit e2091c4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions tests/plugins/sample_processors/test_htsinfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,17 @@ def test_process(self, tmpdir, monkeypatch):

def patched_run(self, cmd) -> None:
"""Patch `run()` method."""
run_dir = Path(tmpdir)
run_dir = Path(tmpdir) / "runs" / config.run.identifier
src = Path(__file__).parents[2] / "files" / "sample_table.tsv"
dst_in = run_dir / "samples_result.tsv"
dst_out = run_dir / "samples_htsinfer.tsv"
dst_in = run_dir / "samples_htsinfer.tsv"
dst_out = run_dir / "samples_result.tsv"
print(dst_out)
shutil.copyfile(src, dst_in)
shutil.copyfile(src, dst_out)

monkeypatch.setattr(SnakemakeExecutor, "run", patched_run)
df_out = hts.process(loc=outdir, workflow=workflow)
assert len(df_out.index) == 2
assert len(df_out.index) == 5

def test_process_empty(self, tmpdir, caplog):
"""Test `.process()` method with no records."""
Expand Down Expand Up @@ -104,16 +105,16 @@ def test_process_dry_run(self, tmpdir, monkeypatch):

def patched_run(self, cmd) -> None:
"""Patch `run()` method."""
run_dir = Path(tmpdir)
run_dir = Path(tmpdir) / "runs" / config.run.identifier
src = Path(__file__).parents[2] / "files" / "sample_table.tsv"
dst_in = run_dir / "samples_result.tsv"
dst_out = run_dir / "samples_htsinfer.tsv"
dst_in = run_dir / "samples_htsinfer.tsv"
dst_out = run_dir / "samples_result.tsv"
shutil.copyfile(src, dst_in)
shutil.copyfile(src, dst_out)

monkeypatch.setattr(SnakemakeExecutor, "run", patched_run)
df_out = hts.process(loc=outdir, workflow=workflow)
assert len(df_out.index) == 2
assert len(df_out.index) == 5

def test__configure_run(self, tmpdir):
"""Test `._configure_run()` method."""
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_normal_mode_with_args(self, monkeypatch, tmpdir):
)
with pytest.raises(SystemExit) as exc:
main()
assert exc.value.code == 0
assert exc.value.code == 1

def test_normal_mode_with_runtime_error(self, monkeypatch, tmpdir):
"""Call with runtime error being raised."""
Expand Down

0 comments on commit e2091c4

Please sign in to comment.