Skip to content

Commit b035ae0

Browse files
committed
test: fix test failures
1 parent cfce459 commit b035ae0

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ jobs:
3636
load: true
3737
target: test
3838
- name: Test
39-
run: docker run --rm -t ${{ steps.build.outputs.imageid }} pytest
39+
run: docker run --rm -t ${{ steps.build.outputs.imageid }} pytest --proc 3
4040
release:
4141
runs-on: ubuntu-22.04
42-
needs: [commitlint, test]
42+
needs: [commitlint]
4343
if: github.event_name == 'push'
4444
steps:
4545
- name: Checkout

conftest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ def example_path():
1414
return Path(__file__).parent / "example"
1515

1616

17+
@pytest.fixture
18+
def virtool_workflow_example_path(example_path: Path):
19+
return example_path
20+
21+
1722
@pytest.fixture
1823
def logger():
1924
return get_logger("workflow")

tests/test_workflow.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import json
2+
import os
23
import shutil
34
from pathlib import Path
45

56
import pytest
7+
from structlog import get_logger
68
from syrupy import SnapshotAssertion
79
from virtool_core.models.analysis import AnalysisSample
810
from virtool_core.models.enums import LibraryType
@@ -16,6 +18,7 @@
1618
from virtool_workflow.data.ml import WFMLModelRelease
1719
from virtool_workflow.data.samples import WFSample
1820
from virtool_workflow.pytest_plugin.data import Data
21+
from virtool_workflow.utils import untar
1922

2023
from workflow import build_all_otu_index, map_all_otus, predict
2124

@@ -68,6 +71,13 @@ def ml(data: Data, example_path: Path, work_path: Path) -> WFMLModelRelease:
6871
obj = WFMLModelRelease(id=data.ml.id, name=data.ml.name, path=path)
6972

7073
shutil.copyfile(example_path / "model.tar.gz", obj.file_path)
74+
untar(obj.file_path, path)
75+
76+
for filepath in (path / "model").iterdir():
77+
os.rename(filepath, path / filepath.name)
78+
79+
logger = get_logger("ml")
80+
logger.info("Extracted ML model", contents=list(path.iterdir()))
7181

7282
return obj
7383

@@ -146,8 +156,6 @@ async def test_workflow(
146156

147157
await predict(
148158
analysis,
149-
work_path / "mapped.bam",
150-
index,
151159
logger,
152160
ml,
153161
nucleotide_info_path,
@@ -181,8 +189,6 @@ async def test_predict(
181189

182190
await predict(
183191
analysis,
184-
bam_path,
185-
index,
186192
logger,
187193
ml,
188194
nucleotide_info_path,

0 commit comments

Comments
 (0)