Skip to content

Commit

Permalink
Merge pull request #568 from ged-lab/fix/filter_abund_cov
Browse files Browse the repository at this point in the history
increase filter_abund.py coverage
  • Loading branch information
mr-c committed Dec 30, 2014
2 parents 3b4137e + a35e7f9 commit 4601b7b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ third-party/zlib/zlib.pc
pip-log.txt
sphinx-contrib
compile_commands.json
.DS_Store
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2014-12-30 Michael Wright <[email protected]>

* tests/test_scripts.py: Attained complete testing coverage for
scripts/filter_abund.py

2014-12-30 Brian Wyss <[email protected]>

* tests/test_scripts.py: added four new tests:
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[nosetests]
verbosity = 2
#stop = TRUE
stop = TRUE
attr = !known_failing,!jenkins
#processes = -1 # breaks xunit output

Expand Down
23 changes: 22 additions & 1 deletion tests/test_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 4601b7b

Please sign in to comment.