Skip to content

Commit

Permalink
parametrization
Browse files Browse the repository at this point in the history
  • Loading branch information
kedhammar committed Oct 11, 2024
1 parent 81b91ea commit fb92189
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions tests/analysis/test_analysis_element.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,39 @@
from io import StringIO
from tempfile import TemporaryDirectory
from unittest.mock import patch

import pandas as pd
import pytest

from tests.element.test_Element_Runs import create_element_run_dir, get_config


def test_run_preprocessing(create_dirs):
def get_run_kwargs() -> list[dict]:
parameter_string_table = """
lims_manifest run_finished outcome_completed sync_finished demux_dir demux_done nosync
False False False False False False False
True False False False False False False
True True False False False False False
True True True False False False False
True True True True False False False
True True True True True False False
True True True True True True False
True True True True True True True
"""
# Turn string table to datastream
data = StringIO(parameter_string_table)

# Read data, trimming whitespace
df = pd.read_csv(data, sep=r"\s+")

# Compile into list of parameters to use
run_kwargs = df.to_dict(orient="records")

return run_kwargs


@pytest.mark.parametrize("run_kwargs", get_run_kwargs())
def test_run_preprocessing(create_dirs, run_kwargs):
tmp: TemporaryDirectory = create_dirs

# Mock config
Expand All @@ -21,7 +50,7 @@ def test_run_preprocessing(create_dirs):
mock_subprocess.start()

# Create run dir and associated LIMS manifest
run_dir = create_element_run_dir(tmp=tmp)
run_dir = create_element_run_dir(tmp=tmp, **run_kwargs)

# Import module to test
from taca.analysis import analysis_element as to_test
Expand Down

0 comments on commit fb92189

Please sign in to comment.