Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pytest issue on macos #144

Merged
merged 11 commits into from Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/tests.yml
Expand Up @@ -27,7 +27,7 @@ jobs:
- { python-version: 3.9, os: ubuntu-latest }
- { python-version: 3.7, os: macos-latest }
- { python-version: 3.8, os: macos-latest }
# - { python-version: 3.9, os: macos-latest } # segmentation fault due to missing py3.9 macOSX wheel https://github.com/rpy2/rpy2/issues/846
- { python-version: 3.9, os: macos-latest } # segmentation fault due to missing py3.9 macOSX wheel https://github.com/rpy2/rpy2/issues/846
# disabled until it's fixed.
runs-on: ${{ matrix.config.os }}
env:
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
shell: bash -l {0}

- name: Set up R
uses: r-lib/actions/setup-r@v1
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ steps.R.outputs.version}}

Expand Down Expand Up @@ -153,6 +153,7 @@ jobs:
remotes::install_cran("BiocManager")
BiocManager::install(version = ${{ steps.R.outputs.biocversion}}, ask = FALSE)
BiocManager::install(c('Biostrings', 'GenomicAlignments', 'IRanges'))
install.packages('matrixStats')
install.packages(c('shazam', 'alakazam', 'tigger', 'airr', 'optparse'))
shell: Rscript {0}

Expand Down
21 changes: 13 additions & 8 deletions tests/test_preprocessing.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
import pytest
import sys
import os
import pandas as pd
import dandelion as ddl
Expand Down Expand Up @@ -65,9 +66,10 @@ def test_reannotate_fails(create_testfolder, database_paths):
filename_prefix='filtered')


@pytest.mark.parametrize("filename,expected",
[pytest.param('filtered', 5),
pytest.param('all', 10)])
@pytest.mark.parametrize(
"filename,expected",
[pytest.param('filtered', 5),
pytest.param('all', 10)])
def test_reannotategenes(create_testfolder, database_paths, filename,
expected):
ddl.pp.reannotate_genes(str(create_testfolder),
Expand Down Expand Up @@ -159,11 +161,13 @@ def test_update_germlines(create_testfolder, processed_files, database_paths):
assert len(vdj.germline) > 0


@pytest.mark.parametrize(
"freq,colname,dtype",
[pytest.param(True, 'mu_freq', float),
pytest.param(False, 'mu_count', int)])
def test_quantify_mut(create_testfolder, processed_files, freq, colname, dtype):
@pytest.mark.parametrize("freq,colname,dtype", [
pytest.param(True, 'mu_freq', float),
pytest.param(False, 'mu_count', int)
])
@pytest.mark.skipif(sys.platform == 'darwin', reason="macos CI stalls.")
def test_quantify_mut(create_testfolder, processed_files, freq, colname,
dtype):
f = create_testfolder / str('dandelion/' + processed_files['filtered'])
ddl.pp.quantify_mutations(f, frequency=freq)
dat = pd.read_csv(f, sep='\t')
Expand All @@ -175,6 +179,7 @@ def test_quantify_mut(create_testfolder, processed_files, freq, colname, dtype):
"freq,colname",
[pytest.param(True, 'mu_freq'),
pytest.param(False, 'mu_count')])
@pytest.mark.skipif(sys.platform == 'darwin', reason="macos CI stalls.")
def test_quantify_mut_2(create_testfolder, processed_files, freq, colname):
f = create_testfolder / str('dandelion/' + processed_files['filtered'])
vdj = ddl.Dandelion(f)
Expand Down
6 changes: 6 additions & 0 deletions tests/test_rpy2.py
@@ -1,10 +1,13 @@
#!/usr/bin/env python
import pandas as pd
import dandelion as ddl
import sys
import pytest

from fixtures import (airr_reannotated, create_testfolder, database_paths)


@pytest.mark.skipif(sys.platform == 'darwin', reason="macos CI stalls.")
def test_importrpy2():

from rpy2.robjects.packages import importr
Expand All @@ -15,6 +18,7 @@ def test_importrpy2():
assert sh.__module__ == 'rpy2.robjects.packages'


@pytest.mark.skipif(sys.platform == 'darwin', reason="macos CI stalls.")
def test_mutation(create_testfolder, airr_reannotated):
f = create_testfolder / "test.tsv"
airr_reannotated.to_csv(f, sep='\t', index=False)
Expand All @@ -26,6 +30,7 @@ def test_mutation(create_testfolder, airr_reannotated):
assert not vdj.data.mu_freq.empty


@pytest.mark.skipif(sys.platform == 'darwin', reason="macos CI stalls.")
def test_create_germlines(create_testfolder, database_paths):
f = create_testfolder / "test.tsv"
out = pd.read_csv(f, sep='\t')
Expand All @@ -34,6 +39,7 @@ def test_create_germlines(create_testfolder, database_paths):
assert not vdj.data.germline_alignment_d_mask.empty


@pytest.mark.skipif(sys.platform == 'darwin', reason="macos CI stalls.")
def test_manual_threshold_and_define_clones(create_testfolder):
f = create_testfolder / "test.tsv"
out = pd.read_csv(f, sep='\t')
Expand Down