From 598ff0fc83a27cf800a698c408867491c4568d2a Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Sat, 6 Apr 2024 19:06:42 +0200 Subject: [PATCH] tests: adjust to new warnings and errors --- tests/integration/test_bracken_etl.py | 1 + tests/integration/test_diamond_etl.py | 5 +++-- tests/integration/test_ganon_etl.py | 2 +- tests/integration/test_kaiju_etl.py | 1 + tests/integration/test_kraken2_etl.py | 1 + tests/integration/test_metaphlan_etl.py | 1 + .../application/bracken/test_bracken_profile.py | 1 + .../application/centrifuge/test_centrifuge_profile.py | 1 + .../infrastructure/application/ganon/test_ganon_profile.py | 5 +++-- .../infrastructure/application/kaiju/test_kaiju_profile.py | 1 + .../infrastructure/application/kmcp/test_kmcp_profile.py | 1 + .../application/kraken2/test_kraken2_profile.py | 1 + 12 files changed, 16 insertions(+), 5 deletions(-) diff --git a/tests/integration/test_bracken_etl.py b/tests/integration/test_bracken_etl.py index bff6e3a..95d4223 100644 --- a/tests/integration/test_bracken_etl.py +++ b/tests/integration/test_bracken_etl.py @@ -71,6 +71,7 @@ def other_profile(data_dir: Path, request: pytest.FixtureRequest) -> Path: ), ], ) +@pytest.mark.filterwarnings("error") def test_bracken_etl( bracken_data_dir: Path, filename: str, diff --git a/tests/integration/test_diamond_etl.py b/tests/integration/test_diamond_etl.py index f28db5f..cc3bef2 100644 --- a/tests/integration/test_diamond_etl.py +++ b/tests/integration/test_diamond_etl.py @@ -22,6 +22,7 @@ from pathlib import Path import pytest +from pandas.errors import ParserError from pandera.errors import SchemaErrors from taxpasta.application.error import StandardisationError @@ -60,11 +61,11 @@ def other_profile(data_dir: Path, request: pytest.FixtureRequest) -> Path: "diamond_valid_2.tsv", pytest.param( "diamond_invalid_1.tsv", - marks=pytest.mark.raises(exception=SchemaErrors), + marks=pytest.mark.raises(exception=ParserError), ), pytest.param( "diamond_invalid_2.tsv", - marks=pytest.mark.raises(exception=SchemaErrors), + marks=pytest.mark.raises(exception=ParserError), ), ], ) diff --git a/tests/integration/test_ganon_etl.py b/tests/integration/test_ganon_etl.py index 094a3ce..595a9da 100644 --- a/tests/integration/test_ganon_etl.py +++ b/tests/integration/test_ganon_etl.py @@ -59,7 +59,7 @@ def other_profile(data_dir: Path, request: pytest.FixtureRequest) -> Path: "2612_pe_ERR5766176_db1.ganon.tre", pytest.param( "invalid_2612_pe_ERR5766176_db1.ganon_missing_column.tre", - marks=pytest.mark.raises(exception=SchemaErrors), + marks=pytest.mark.raises(exception=ValueError), ), ], ) diff --git a/tests/integration/test_kaiju_etl.py b/tests/integration/test_kaiju_etl.py index d789657..1b4f22e 100644 --- a/tests/integration/test_kaiju_etl.py +++ b/tests/integration/test_kaiju_etl.py @@ -64,6 +64,7 @@ def other_profile(data_dir: Path, request: pytest.FixtureRequest) -> Path: ), ], ) +@pytest.mark.filterwarnings("error") def test_kaiju_etl( kaiju_data_dir: Path, filename: str, diff --git a/tests/integration/test_kraken2_etl.py b/tests/integration/test_kraken2_etl.py index 8baf87e..4d7b356 100644 --- a/tests/integration/test_kraken2_etl.py +++ b/tests/integration/test_kraken2_etl.py @@ -71,6 +71,7 @@ def other_profile(data_dir: Path, request: pytest.FixtureRequest) -> Path: ), ], ) +@pytest.mark.filterwarnings("error") def test_kraken2_etl( kraken2_data_dir: Path, filename: str, diff --git a/tests/integration/test_metaphlan_etl.py b/tests/integration/test_metaphlan_etl.py index 4cc9ff9..3f1d30e 100644 --- a/tests/integration/test_metaphlan_etl.py +++ b/tests/integration/test_metaphlan_etl.py @@ -86,6 +86,7 @@ def test_valid_profile_etl( ) +@pytest.mark.filterwarnings("error") def test_invalid_profile_etl( invalid_metaphlan_profile: Path, ): diff --git a/tests/unit/infrastructure/application/bracken/test_bracken_profile.py b/tests/unit/infrastructure/application/bracken/test_bracken_profile.py index 599ccab..699dc4a 100644 --- a/tests/unit/infrastructure/application/bracken/test_bracken_profile.py +++ b/tests/unit/infrastructure/application/bracken/test_bracken_profile.py @@ -159,6 +159,7 @@ def test_column_presence(profile: pd.DataFrame): ), ], ) +@pytest.mark.filterwarnings("error") def test_fraction_total_reads(profile: pd.DataFrame): """Test that the fraction column is checked.""" BrackenProfile.validate(profile) diff --git a/tests/unit/infrastructure/application/centrifuge/test_centrifuge_profile.py b/tests/unit/infrastructure/application/centrifuge/test_centrifuge_profile.py index 17d8286..3f4796b 100644 --- a/tests/unit/infrastructure/application/centrifuge/test_centrifuge_profile.py +++ b/tests/unit/infrastructure/application/centrifuge/test_centrifuge_profile.py @@ -135,6 +135,7 @@ def test_column_presence(profile: pd.DataFrame): ), ], ) +@pytest.mark.filterwarnings("error") def test_percent(profile: pd.DataFrame): """Test that the percent column is checked.""" CentrifugeProfile.validate(profile) diff --git a/tests/unit/infrastructure/application/ganon/test_ganon_profile.py b/tests/unit/infrastructure/application/ganon/test_ganon_profile.py index 48b5031..52fe010 100644 --- a/tests/unit/infrastructure/application/ganon/test_ganon_profile.py +++ b/tests/unit/infrastructure/application/ganon/test_ganon_profile.py @@ -128,7 +128,7 @@ def test_column_presence(profile: pd.DataFrame): ) ), marks=pytest.mark.raises( - exception=SchemaError, message="check_compositionality" + exception=SchemaError, message="" ), ), pytest.param( @@ -148,11 +148,12 @@ def test_column_presence(profile: pd.DataFrame): ) ), marks=pytest.mark.raises( - exception=SchemaError, message="check_compositionality" + exception=SchemaError, message="" ), ), ], ) +@pytest.mark.filterwarnings("error") def test_percent(profile: pd.DataFrame): """Test that the percent column (percent_cumulative) is checked.""" GanonProfile.validate(profile) diff --git a/tests/unit/infrastructure/application/kaiju/test_kaiju_profile.py b/tests/unit/infrastructure/application/kaiju/test_kaiju_profile.py index 923764c..5adfd4f 100644 --- a/tests/unit/infrastructure/application/kaiju/test_kaiju_profile.py +++ b/tests/unit/infrastructure/application/kaiju/test_kaiju_profile.py @@ -143,6 +143,7 @@ def test_column_presence(profile: pd.DataFrame): ), ], ) +@pytest.mark.filterwarnings("error") def test_percent(profile: pd.DataFrame): """Test that the percent column is checked.""" KaijuProfile.validate(profile) diff --git a/tests/unit/infrastructure/application/kmcp/test_kmcp_profile.py b/tests/unit/infrastructure/application/kmcp/test_kmcp_profile.py index b0635ad..b800f69 100644 --- a/tests/unit/infrastructure/application/kmcp/test_kmcp_profile.py +++ b/tests/unit/infrastructure/application/kmcp/test_kmcp_profile.py @@ -171,6 +171,7 @@ def test_column_presence(profile: pd.DataFrame): ), ], ) +@pytest.mark.filterwarnings("error") def test_percent(profile: pd.DataFrame): """Test that the percent column (percent_cumulative) is checked.""" KMCPProfile.validate(profile) diff --git a/tests/unit/infrastructure/application/kraken2/test_kraken2_profile.py b/tests/unit/infrastructure/application/kraken2/test_kraken2_profile.py index 2202f63..2df6f0e 100644 --- a/tests/unit/infrastructure/application/kraken2/test_kraken2_profile.py +++ b/tests/unit/infrastructure/application/kraken2/test_kraken2_profile.py @@ -164,6 +164,7 @@ def test_column_presence(profile: pd.DataFrame): ), ], ) +@pytest.mark.filterwarnings("error") def test_percent(profile: pd.DataFrame): """Test that the percent column is checked.""" Kraken2Profile.validate(profile)