Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2015-10-25 Titus Brown <[email protected]>

* scripts/normalize-by-median.py,tests/test_normalize_by_median.py: test
and fix for close of --output file after first input file.

2015-10-05 Michael R. Crusoe <[email protected]>

* lib/magic: add file extensions, one media type, and a better comment
Expand Down
2 changes: 1 addition & 1 deletion scripts/normalize-by-median.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def main(): # pylint: disable=too-many-branches,too-many-statements
write_record(record, outfp)

log_info('output in {name}', name=describe_file_handle(outfp))
if not is_block(outfp):
if not args.single_output_file:
outfp.close()

# finished - print out some diagnostics.
Expand Down
11 changes: 11 additions & 0 deletions tests/test_normalize_by_median.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,3 +847,14 @@ def test_diginorm_basic_functionality_5():
'b/1', 'b/2',
'c/1', 'c/2',
'd/1', 'd/2']), seqs


def test_normalize_by_median_outfile_closed_err():
infile1 = utils.get_test_data('paired-mixed.fa.pe')
infile2 = utils.get_test_data("test-abund-read-2.fa")
outfile = utils.get_temp_filename('outfile_xxx')
script = 'normalize-by-median.py'
args = ['-o', outfile, infile1, infile2]
(status, out, err) = utils.runscript(script, args)
assert status == 0, (out, err)
assert os.path.exists(outfile)