Skip to content

Commit

Permalink
pytest: marked slow tests, full suite: 51 tests in 59 sec, fast: 40…
Browse files Browse the repository at this point in the history
… tests in 13.7 sec
  • Loading branch information
deeenes committed Jul 1, 2024
1 parent a1cab6c commit 0465530
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,13 @@ testpaths = [
"tests",
]
xfail_strict = true
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')"
]
addopts = [
# "-Werror", # if 3rd party libs raise DeprecationWarnings, just use filterwarnings below
"--import-mode=importlib", # allow using test files with same name
"-m not slow",
]
filterwarnings = [
# "ignore:.*U.*mode is deprecated:DeprecationWarning",
Expand Down
3 changes: 3 additions & 0 deletions tests/test_deseq2.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import pytest

import pandas as pd

from networkcommons._data.omics.deseq2 import deseq2


@pytest.mark.slow
def test_deseq2():

# Create dummy dataset for testing, samples as colnames, genes as rownames
Expand Down
4 changes: 4 additions & 0 deletions tests/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def human_protein_ids() -> list[str]:
return list(SAMPLE_HUMAN_PROTEINS.keys())


@pytest.mark.slow
def test_node_human_protein(human_protein_ids):

for _id in human_protein_ids:
Expand All @@ -62,6 +63,7 @@ def test_node_human_protein(human_protein_ids):
assert node.asdict() == SAMPLE_HUMAN_PROTEINS[_id]


@pytest.mark.slow
def test_node_id_translation(human_protein_ids):

upc1_ensg = human_protein_ids[2]
Expand All @@ -73,13 +75,15 @@ def test_node_id_translation(human_protein_ids):
assert list(upc1.as_idtype('uniprot'))[0].asdict() == upc1_uniprot_attrs


@pytest.mark.slow
def test_node_mouse_protein():

egfr_m = _node.Node('Egfr', organism = 'mouse')

assert egfr_m.asdict() == SAMPLE_MOUSE_PROTEINS['Egfr']


@pytest.mark.slow
def test_node_orthology_translation():

egfr_m_o_attrs = SAMPLE_MOUSE_PROTEINS['Egfr'].copy()
Expand Down
6 changes: 6 additions & 0 deletions tests/test_omics.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def test_commons_url():
assert 'metadata' in url


@pytest.mark.slow
def test_download(tmp_path):

url = omics.common._commons_url('test', table = 'meta')
Expand All @@ -43,6 +44,7 @@ def test_download(tmp_path):
assert line.startswith('sample_ID\t')


@pytest.mark.slow
def test_open():

url = omics.common._commons_url('test', table = 'meta')
Expand All @@ -63,6 +65,7 @@ def test_open_df():
assert df.shape == (4, 2)


@pytest.mark.slow
def test_decryptm_datasets():

dsets = omics.decryptm.decryptm_datasets()
Expand All @@ -78,6 +81,7 @@ def decryptm_args():
return 'KDAC_Inhibitors', 'Acetylome', 'curves_CUDC101.txt'


@pytest.mark.slow
def test_decryptm_table(decryptm_args):

df = omics.decryptm.decryptm_table(*decryptm_args)
Expand All @@ -87,6 +91,7 @@ def test_decryptm_table(decryptm_args):
assert df.EC50.dtype == 'float64'


@pytest.mark.slow
def test_decryptm_experiment(decryptm_args):

dfs = omics.decryptm.decryptm_experiment(*decryptm_args[:2])
Expand All @@ -98,6 +103,7 @@ def test_decryptm_experiment(decryptm_args):
assert dfs[3].EC50.dtype == 'float64'


@pytest.mark.slow
def test_panacea():

dfs = omics.panacea()
Expand Down

0 comments on commit 0465530

Please sign in to comment.