Skip to content

Commit

Permalink
refactor: move fixtures to dedicated module
Browse files Browse the repository at this point in the history
  • Loading branch information
igboyes committed May 27, 2024
1 parent e68d32c commit fb19fe1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ENV VIRTUAL_ENV=/app/.venv \
COPY --from=bowtie2 /build/bowtie2/* /usr/local/bin/
COPY --from=pigz /build/pigz-2.8/pigz /usr/local/bin/pigz
COPY --from=build /workflow/.venv /workflow/.venv
COPY utils.py workflow.py VERSION* ./
COPY fixtures.py utils.py workflow.py VERSION* ./

FROM build as test
COPY --from=bowtie2 /build/bowtie2/* /usr/local/bin/
Expand All @@ -45,4 +45,4 @@ ENV PATH="/root/.local/bin:${PATH}" \
POETRY_VIRTUALENVS_CREATE=1
RUN poetry install
COPY tests ./tests
COPY utils.py workflow.py ./
COPY fixtures.py utils.py workflow.py ./
25 changes: 25 additions & 0 deletions fixtures.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import asyncio
from pathlib import Path

from pyfixtures import fixture


@fixture
async def bowtie_path(work_path: Path) -> Path:
"""The path to the generated Bowtie2 index files."""
path = work_path / "bowtie"
await asyncio.to_thread(path.mkdir)

return path / "reference"


@fixture
async def export_json_path(work_path: Path) -> Path:
"""The path to the generated JSON index export file."""
return work_path / "reference.json.gz"


@fixture
async def fasta_path(work_path: Path) -> Path:
"""The path to the generated index file."""
return work_path / "reference.fa"
22 changes: 0 additions & 22 deletions workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
from pathlib import Path

from pyfixtures import fixture
from virtool_core.utils import compress_file
from virtool_workflow import RunSubprocess, hooks, step
from virtool_workflow.data.indexes import WFNewIndex
Expand All @@ -15,27 +14,6 @@ async def delete_index(new_index: WFNewIndex):
await new_index.delete()


@fixture
async def bowtie_path(work_path: Path) -> Path:
"""The path to the generated Bowtie2 index files."""
path = work_path / "bowtie"
await asyncio.to_thread(path.mkdir)

return path / "reference"


@fixture
async def export_json_path(work_path: Path) -> Path:
"""The path to the generated JSON index export file."""
return work_path / "reference.json.gz"


@fixture
async def fasta_path(work_path: Path) -> Path:
"""The path to the generated index file."""
return work_path / "reference.fa"


@step(name="Process OTUs")
async def process_otus(
export_json_path: Path,
Expand Down

0 comments on commit fb19fe1

Please sign in to comment.