tests failing (before and after python3 conversion)
Issue #22
resolved
Hi Jason,
I noticed that the scripts haven't been converted to python 3 (although presto can be successfully imported), so I tried using 2to3 to convert the whole package.
2to3 --output-dir=presto3 -W -n presto
After that, I tried running your test suite, but noticed that there were some errors.
(venv343) ➜ presto3 nosetests -w tests -v
test_collapseAnnotation (tests.test_Annotation.TestIgCore) ... FAIL
test_mergeAnnotation (tests.test_Annotation.TestIgCore) ... ok
test_renameAnnotation (tests.test_Annotation.TestIgCore) ... ok
test_alignAssembly (tests.test_AssemblePairs.TestAssemblePairs) ... SKIP: -> alignAssembly() skipped
test_getBlastnAlignment (tests.test_AssemblePairs.TestAssemblePairs) ... SKIP: -> getBlastnAlignment() skipped
test_getUBlastAlignment (tests.test_AssemblePairs.TestAssemblePairs) ... ERROR
test_referenceAssembly (tests.test_AssemblePairs.TestAssemblePairs) ... ERROR
test_calculateSetError (tests.test_BuildConsensus.TestBuildConsensus) ... FAIL
test_deleteSeqPositions (tests.test_BuildConsensus.TestBuildConsensus) ... ok
test_findGapPositions (tests.test_BuildConsensus.TestBuildConsensus) ... ok
test_frequencyConsensus (tests.test_BuildConsensus.TestBuildConsensus) ... ok
test_qualityConsensus (tests.test_BuildConsensus.TestBuildConsensus) ... ok
test_runUClust (tests.test_ClusterSets.TestBuildConsensus) ... ERROR
test_testSeqEqual (tests.test_CollapseSeq.TestCollapseSeq) ... FAIL
Determine if two sequences are equal, excluding missing positions ... ERROR
test_convert454Header (tests.test_ConvertHeaders.TestConvertHeaders) ... ok
test_convertGenbankHeader (tests.test_ConvertHeaders.TestConvertHeaders) ... ok
test_convertGenericHeader (tests.test_ConvertHeaders.TestConvertHeaders) ... ok
test_convertIMGTHeader (tests.test_ConvertHeaders.TestConvertHeaders) ... ok
test_convertIlluminaHeader (tests.test_ConvertHeaders.TestConvertHeaders) ... ok
test_convertSRAHeader (tests.test_ConvertHeaders.TestConvertHeaders) ... ok
test_alignPrimers (tests.test_MaskPrimers.TestMaskPrimers) ... [1] 68314 segmentation fault nosetests -w tests -v
I then went back to the old python 2 version, and found that some of the tests were still failing.
(venv279)➜ presto hg checkout 172
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(venv279)➜ presto nosetests -w tests
SSEEF....EFE..............
======================================================================
ERROR: test_getUBlastAlignment (tests.test_AssemblePairs.TestAssemblePairs)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/dkoppstein/src/bitbucket.org/javh/presto/tests/test_AssemblePairs.py", line 30, in setUp
self.ref_dict = {s.id:s.upper() for s in readSeqFile(self.ref_file)}
File "/Users/dkoppstein/src/bitbucket.org/javh/presto/tests/test_AssemblePairs.py", line 30, in <dictcomp>
self.ref_dict = {s.id:s.upper() for s in readSeqFile(self.ref_file)}
File "/usr/local/opt/pyenv/versions/venv279/lib/python2.7/site-packages/Bio/SeqIO/__init__.py", line 572, in parse
with as_handle(handle, mode) as fp:
File "/usr/local/opt/pyenv/versions/2.7.9/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/usr/local/opt/pyenv/versions/venv279/lib/python2.7/site-packages/Bio/File.py", line 90, in as_handle
with open(handleish, mode, **kwargs) as fp:
IOError: [Errno 2] No such file or directory: 'IG_TR.V.human.F+ORF+infrP.ungapped.fasta'
-------------------- >> begin captured stdout << ---------------------
-> test_getUBlastAlignment()
--------------------- >> end captured stdout << ----------------------
======================================================================
ERROR: test_referenceAssembly (tests.test_AssemblePairs.TestAssemblePairs)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/dkoppstein/src/bitbucket.org/javh/presto/tests/test_AssemblePairs.py", line 30, in setUp
self.ref_dict = {s.id:s.upper() for s in readSeqFile(self.ref_file)}
File "/Users/dkoppstein/src/bitbucket.org/javh/presto/tests/test_AssemblePairs.py", line 30, in <dictcomp>
self.ref_dict = {s.id:s.upper() for s in readSeqFile(self.ref_file)}
File "/usr/local/opt/pyenv/versions/venv279/lib/python2.7/site-packages/Bio/SeqIO/__init__.py", line 572, in parse
with as_handle(handle, mode) as fp:
File "/usr/local/opt/pyenv/versions/2.7.9/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/usr/local/opt/pyenv/versions/venv279/lib/python2.7/site-packages/Bio/File.py", line 90, in as_handle
with open(handleish, mode, **kwargs) as fp:
IOError: [Errno 2] No such file or directory: 'IG_TR.V.human.F+ORF+infrP.ungapped.fasta'
-------------------- >> begin captured stdout << ---------------------
-> test_referenceAssembly()
--------------------- >> end captured stdout << ----------------------
======================================================================
ERROR: test_runUClust (tests.test_ClusterSets.TestBuildConsensus)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/dkoppstein/src/bitbucket.org/javh/presto/tests/test_ClusterSets.py", line 43, in test_runUClust
results = mod.runUClust(self.records_clust)
File "/Users/dkoppstein/src/bitbucket.org/javh/presto/ClusterSets.py", line 80, in runUClust
stdout_str = check_output(cmd, stderr=STDOUT, shell=False)
File "/usr/local/opt/pyenv/versions/2.7.9/lib/python2.7/subprocess.py", line 566, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "/usr/local/opt/pyenv/versions/2.7.9/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/local/opt/pyenv/versions/2.7.9/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
-------------------- >> begin captured stdout << ---------------------
-> test_runUClust()
--------------------- >> end captured stdout << ----------------------
======================================================================
ERROR: Determine if two sequences are equal, excluding missing positions
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/opt/pyenv/versions/venv279/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/usr/local/opt/pyenv/versions/venv279/lib/python2.7/site-packages/nose/util.py", line 620, in newfunc
return func(*arg, **kw)
TypeError: testSeqEqual() takes at least 2 arguments (0 given)
======================================================================
FAIL: test_calculateSetError (tests.test_BuildConsensus.TestBuildConsensus)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/dkoppstein/src/bitbucket.org/javh/presto/tests/test_BuildConsensus.py", line 78, in test_calculateSetError
self.assertAlmostEqual(1 - 27 / 30, error, places=4)
AssertionError: 0.09999999999999998 != 0.25 within 4 places
-------------------- >> begin captured stdout << ---------------------
-> test_calculateSetError()
REF> CGGCGTAA
ERROR> 0.250000
--------------------- >> end captured stdout << ----------------------
======================================================================
FAIL: test_testSeqEqual (tests.test_CollapseSeq.TestCollapseSeq)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/dkoppstein/src/bitbucket.org/javh/presto/tests/test_CollapseSeq.py", line 41, in test_testSeqEqual
self.fail()
AssertionError: None
-------------------- >> begin captured stdout << ---------------------
-> test_testSeqEqual()
True
--------------------- >> end captured stdout << ----------------------
----------------------------------------------------------------------
Ran 26 tests in 0.258s
FAILED (SKIP=2, errors=4, failures=2)
I think some of these can be attributed to the test environment, i.e. not finding the IG_TR file. I'll keep digging and updating this issue.
Comments (3)
-
-
I removed the
self.fail()
from test_CollapseSeq and fixed some bugs in test_Sequence. -
- changed status to resolved
All tests in the 'Python3 conversion' branch should be working with python 3.
- Log in to comment
Thanks. Just FYI - the unit tests are still very rough. Coverage is pretty poor. I just started add tests whenever I updated/added functions with the intention of slowly fill them up. The tests in:
Are currently hardcoded to fail with
self.fail()
. For now, don't worry about the AssemblePairs tests. They need some cleanup. The only one of real concern istest_calculateSetError
in tests_BuildConsensus.py