Skip to content

Commit

Permalink
Merge pull request #144 from zktuong/devel
Browse files Browse the repository at this point in the history
Fix pytest issue on macos
  • Loading branch information
zktuong committed Apr 22, 2022
2 parents 80e673f + 6e53c0d commit 980e64d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
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

0 comments on commit 980e64d

Please sign in to comment.