diff --git a/.gitignore b/.gitignore index 51c8a5c00e..671ff12d81 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ third-party/zlib/zlib.pc pip-log.txt sphinx-contrib compile_commands.json +.DS_Store diff --git a/ChangeLog b/ChangeLog index d0d7a7e5a9..6019397cb7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-12-30 Michael Wright + + * tests/test_scripts.py: Attained complete testing coverage for + scripts/filter_abund.py + 2014-12-30 Brian Wyss * tests/test_scripts.py: added four new tests: diff --git a/setup.cfg b/setup.cfg index e331cee69e..fc5c0098bb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [nosetests] verbosity = 2 -#stop = TRUE +stop = TRUE attr = !known_failing,!jenkins #processes = -1 # breaks xunit output diff --git a/tests/test_scripts.py b/tests/test_scripts.py index b6386a44b9..d20aa1828d 100644 --- a/tests/test_scripts.py +++ b/tests/test_scripts.py @@ -166,23 +166,44 @@ def _make_counting(infilename, SIZE=1e7, N=2, K=20, BIGCOUNT=True): def test_filter_abund_1(): + script = scriptpath('filter-abund.py') + infile = utils.get_temp_filename('test.fa') + n_infile = utils.get_temp_filename('test-fastq-n-reads.fq') + in_dir = os.path.dirname(infile) + n_in_dir = os.path.dirname(n_infile) shutil.copyfile(utils.get_test_data('test-abund-read-2.fa'), infile) + shutil.copyfile(utils.get_test_data('test-fastq-n-reads.fq'), n_infile) + counting_ht = _make_counting(infile, K=17) + n_counting_ht = _make_counting(n_infile, K=17) - script = scriptpath('filter-abund.py') args = [counting_ht, infile] utils.runscript(script, args, in_dir) outfile = infile + '.abundfilt' + n_outfile = n_infile + '.abundfilt' + n_outfile2 = n_infile + '2.abundfilt' + assert os.path.exists(outfile), outfile seqs = set([r.sequence for r in screed.open(outfile)]) + assert len(seqs) == 1, seqs assert 'GGTTGACGGGGCTCAGGG' in seqs + args = [n_counting_ht, n_infile] + utils.runscript(script, args, n_in_dir) + + seqs = set([r.sequence for r in screed.open(n_infile)]) + assert os.path.exists(n_outfile), n_outfile + + args = [n_counting_ht, n_infile, '-o', n_outfile2] + utils.runscript(script, args, in_dir) + assert os.path.exists(n_outfile2), n_outfile2 + def test_filter_abund_2(): infile = utils.get_temp_filename('test.fa')