Skip to content

Commit

Permalink
Skip FastaVariant tests on pypy.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdshw5 committed Apr 2, 2015
1 parent 90c3bbc commit 9ccc470
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions tests/test_FastaVariant.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import os
from pyfaidx import FastaVariant, Fasta
from itertools import chain
from unittest import TestCase
from subprocess import call
import shlex
from nose.plugins.skip import SkipTest
import sys
pypy = '__pypy__' in sys.builtin_module_names


path = os.path.dirname(__file__)
os.chdir(path)
Expand All @@ -17,25 +18,35 @@ def tearDown(self):
pass # some tests may delete this file

def test_fetch_variant(self):
if not pypy:
raise SkipTest
fasta = FastaVariant('data/chr22.fasta', 'data/chr22.vcf.gz', hom=True, het=True, as_raw=True)
assert fasta['22'][32330458:32330462] == 'CAGG' # het
assert fasta['22'][32352282:32352286] == 'CAGC' # hom

def test_fetch_hom_variant(self):
if not pypy:
raise SkipTest
fasta = FastaVariant('data/chr22.fasta', 'data/chr22.vcf.gz', hom=True, het=False, as_raw=True)
assert fasta['22'][32330458:32330462] == 'CGGG' # het
assert fasta['22'][32352282:32352286] == 'CAGC' # hom

def test_fetch_het_variant(self):
if not pypy:
raise SkipTest
fasta = FastaVariant('data/chr22.fasta', 'data/chr22.vcf.gz', hom=False, het=True, as_raw=True)
assert fasta['22'][32330458:32330462] == 'CAGG' # het
assert fasta['22'][32352282:32352286] == 'CGGC' # hom

def test_all_pos(self):
if not pypy:
raise SkipTest
fasta = FastaVariant('data/chr22.fasta', 'data/chr22.vcf.gz', hom=True, het=True, as_raw=True)
assert fasta['22'].variant_sites == (16042793, 21833121, 29153196, 29187373, 29187448, 29194610, 29821295, 29821332, 29993842, 32330460, 32352284)

def test_all_diff(self):
if not pypy:
raise SkipTest
fasta = FastaVariant('data/chr22.fasta', 'data/chr22.vcf.gz', hom=True, het=True, as_raw=True)
ref = Fasta('data/chr22.fasta', as_raw=True)
assert all(ref['22'][pos-1] != fasta['22'][pos-1] for pos in fasta['22'].variant_sites)

0 comments on commit 9ccc470

Please sign in to comment.