From efdcd2d9fe39337addc2e20af835be6c387a0c9e Mon Sep 17 00:00:00 2001 From: keyabarve <53328492+keyabarve@users.noreply.github.com> Date: Mon, 24 May 2021 12:32:25 -0700 Subject: [PATCH] Initial commit Fixes 3 tests --- tests/test_lca.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/test_lca.py b/tests/test_lca.py index 9ba84b9b28..a6443dbc6c 100644 --- a/tests/test_lca.py +++ b/tests/test_lca.py @@ -971,7 +971,8 @@ def test_single_classify_to_output(): print(out) print(err) - outdata = open(os.path.join(location, 'outfile.txt'), 'rt').read() + with open(os.path.join(location, 'outfile.txt'), 'rt') as fp: + outdata = fp.read() assert 'TARA_ASE_MAG_00031,found,Bacteria,Proteobacteria,Gammaproteobacteria,Alteromonadales,Alteromonadaceae,Alteromonas,Alteromonas_macleodii' in outdata assert 'classified 1 signatures total' in err assert 'loaded 1 LCA databases' in err @@ -996,8 +997,8 @@ def test_single_classify_to_output_no_name(): print(cmd) print(out) print(err) - - outdata = open(os.path.join(location, 'outfile.txt'), 'rt').read() + with open(os.path.join(location, 'outfile.txt'), 'rt') as fp: + outdata = fp.read() print((outdata,)) assert 'xyz,found,Bacteria,Proteobacteria,Gammaproteobacteria,Alteromonadales,Alteromonadaceae,Alteromonas,Alteromonas_macleodii' in outdata assert 'classified 1 signatures total' in err @@ -1521,8 +1522,8 @@ def test_single_summarize_to_output(): print(out) print(err) - outdata = open(os.path.join(location, 'output.txt'), 'rt').read() - + with open(os.path.join(location, 'output.txt'), 'rt') as fp: + outdata = fp.read() assert 'loaded 1 signatures from 1 files total.' in err assert '200,Bacteria,Proteobacteria,Gammaproteobacteria' in outdata