From c904b1b731ed5e3499405661ed9d9c5afd60fabf Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Wed, 23 Jul 2014 17:34:38 -0400 Subject: [PATCH 1/6] Coverage for 'N's in .fq files. --- tests/test_scripts.py | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/tests/test_scripts.py b/tests/test_scripts.py index b6386a44b9..954c3551c1 100644 --- a/tests/test_scripts.py +++ b/tests/test_scripts.py @@ -166,23 +166,37 @@ def _make_counting(infilename, SIZE=1e7, N=2, K=20, BIGCOUNT=True): def test_filter_abund_1(): - infile = utils.get_temp_filename('test.fa') - in_dir = os.path.dirname(infile) +script = scriptpath('filter-abund.py') + + clean_infile = utils.get_temp_filename('test.fa') + n_infile = utils.get_temp_filename('test-fastq-n-reads.fq') shutil.copyfile(utils.get_test_data('test-abund-read-2.fa'), infile) - counting_ht = _make_counting(infile, K=17) + shutil.copyfile(utils.get_test_data('test-fastq-n-reads.fq'), n_infile) - script = scriptpath('filter-abund.py') - args = [counting_ht, infile] + in_dir = os.path.dirname(infile) + n_in_dir = os.path.dirname(n_infile) + + clean_counting_ht = _make_counting(infile, K=17) + n_counting_ht = _make_counting(n_infile, K=17) + + clean_outfile = infile + '.abundfilt' + n_outfile = n_infile + '.abundfilt' + + args = [clean_counting_ht, clean_infile] utils.runscript(script, args, in_dir) - outfile = infile + '.abundfilt' - assert os.path.exists(outfile), outfile + assert os.path.exists(clean_outfile), clean_outfile - seqs = set([r.sequence for r in screed.open(outfile)]) + seqs = set([r.sequence for r in screed.open(clean_outfile)]) assert len(seqs) == 1, seqs assert 'GGTTGACGGGGCTCAGGG' in seqs + args = [n_counting_ht, n_infile] + utils.runscript(script, args, n_in_dir) + + assert os.path.exists(n_outfile), n_outfile + def test_filter_abund_2(): infile = utils.get_temp_filename('test.fa') From 6417c0a1751dc12079503a0155614674b5a62eee Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Thu, 24 Jul 2014 13:28:28 -0400 Subject: [PATCH 2/6] test_filter_abund: coverage for output args --- tests/test_scripts.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/test_scripts.py b/tests/test_scripts.py index 954c3551c1..14008d3dc1 100644 --- a/tests/test_scripts.py +++ b/tests/test_scripts.py @@ -166,21 +166,21 @@ def _make_counting(infilename, SIZE=1e7, N=2, K=20, BIGCOUNT=True): def test_filter_abund_1(): -script = scriptpath('filter-abund.py') + script = scriptpath('filter-abund.py') clean_infile = utils.get_temp_filename('test.fa') n_infile = utils.get_temp_filename('test-fastq-n-reads.fq') - shutil.copyfile(utils.get_test_data('test-abund-read-2.fa'), infile) + shutil.copyfile(utils.get_test_data('test-abund-read-2.fa'), clean_infile) shutil.copyfile(utils.get_test_data('test-fastq-n-reads.fq'), n_infile) - in_dir = os.path.dirname(infile) + in_dir = os.path.dirname(clean_infile) n_in_dir = os.path.dirname(n_infile) - clean_counting_ht = _make_counting(infile, K=17) + clean_counting_ht = _make_counting(clean_infile, K=17) n_counting_ht = _make_counting(n_infile, K=17) - clean_outfile = infile + '.abundfilt' + clean_outfile = clean_infile + '.abundfilt' n_outfile = n_infile + '.abundfilt' args = [clean_counting_ht, clean_infile] @@ -197,6 +197,8 @@ def test_filter_abund_1(): assert os.path.exists(n_outfile), n_outfile + args = [n_counting_ht, n_infile, '-o' 'outfile'] + utils.runscript(script, args, in_dir) def test_filter_abund_2(): infile = utils.get_temp_filename('test.fa') From 1f880ce72bb0e36257f5bd44927a28b564a6bcb7 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Thu, 24 Jul 2014 13:48:44 -0400 Subject: [PATCH 3/6] Changelog Update and filter_abund coverage added. --- .gitignore | 1 + ChangeLog | 5 +++++ tests/test_scripts.py | 26 +++++++++++++++----------- 3 files changed, 21 insertions(+), 11 deletions(-) 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..36d2c968cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-09-16 Michael Wright + + * tests/test_scipts.py: Attained complete testing coverage for + test_filter_abund. + 2014-12-30 Brian Wyss * tests/test_scripts.py: added four new tests: diff --git a/tests/test_scripts.py b/tests/test_scripts.py index 14008d3dc1..244d721457 100644 --- a/tests/test_scripts.py +++ b/tests/test_scripts.py @@ -168,37 +168,41 @@ def _make_counting(infilename, SIZE=1e7, N=2, K=20, BIGCOUNT=True): def test_filter_abund_1(): script = scriptpath('filter-abund.py') - clean_infile = utils.get_temp_filename('test.fa') + infile = utils.get_temp_filename('test.fa') n_infile = utils.get_temp_filename('test-fastq-n-reads.fq') - shutil.copyfile(utils.get_test_data('test-abund-read-2.fa'), clean_infile) - shutil.copyfile(utils.get_test_data('test-fastq-n-reads.fq'), n_infile) - - in_dir = os.path.dirname(clean_infile) + in_dir = os.path.dirname(infile) n_in_dir = os.path.dirname(n_infile) - clean_counting_ht = _make_counting(clean_infile, K=17) + 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) - clean_outfile = clean_infile + '.abundfilt' + args = [counting_ht, infile] + utils.runscript(script, args, in_dir) + + outfile = infile + '.abundfilt' n_outfile = n_infile + '.abundfilt' - args = [clean_counting_ht, clean_infile] - utils.runscript(script, args, in_dir) + assert os.path.exists(outfile), outfile - assert os.path.exists(clean_outfile), clean_outfile + seqs = set([r.sequence for r in screed.open(outfile)]) - seqs = set([r.sequence for r in screed.open(clean_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' 'outfile'] utils.runscript(script, args, in_dir) + assert os.path.exists(outfile), outfile + def test_filter_abund_2(): infile = utils.get_temp_filename('test.fa') From 6725378a9babc160cbcc9e817f48688d9275bd22 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Wed, 1 Oct 2014 02:31:34 -0400 Subject: [PATCH 4/6] Fixed accidental commits to hash functions --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 69e3105dcc18af35cafcd0fb5b3a943995d779f1 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Wed, 1 Oct 2014 02:34:17 -0400 Subject: [PATCH 5/6] ChangeLog fix --- ChangeLog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 36d2c968cc..fc7c9c5482 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2014-09-16 Michael Wright - * tests/test_scipts.py: Attained complete testing coverage for +2014-09-16 Michael Wright + + * tests/test_scripts.py: Attained complete testing coverage for test_filter_abund. 2014-12-30 Brian Wyss From a35e7f94a2b1910814762cce8b01a5b59e1a1a50 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Tue, 30 Dec 2014 13:11:03 -0500 Subject: [PATCH 6/6] look for real outfilename, differentiate between runs --- ChangeLog | 6 ++---- tests/test_scripts.py | 5 +++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index fc7c9c5482..6019397cb7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,7 @@ -2014-09-16 Michael Wright - -2014-09-16 Michael Wright +2014-12-30 Michael Wright * tests/test_scripts.py: Attained complete testing coverage for - test_filter_abund. + scripts/filter_abund.py 2014-12-30 Brian Wyss diff --git a/tests/test_scripts.py b/tests/test_scripts.py index 244d721457..d20aa1828d 100644 --- a/tests/test_scripts.py +++ b/tests/test_scripts.py @@ -185,6 +185,7 @@ def test_filter_abund_1(): outfile = infile + '.abundfilt' n_outfile = n_infile + '.abundfilt' + n_outfile2 = n_infile + '2.abundfilt' assert os.path.exists(outfile), outfile @@ -199,9 +200,9 @@ def test_filter_abund_1(): 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' 'outfile'] + args = [n_counting_ht, n_infile, '-o', n_outfile2] utils.runscript(script, args, in_dir) - assert os.path.exists(outfile), outfile + assert os.path.exists(n_outfile2), n_outfile2 def test_filter_abund_2():