Skip to content

Commit

Permalink
Fix tests for preprocessor
Browse files Browse the repository at this point in the history
  • Loading branch information
rafelafrance committed Feb 15, 2019
1 parent 816c25a commit 5b50a85
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions lib/util.py
Expand Up @@ -58,9 +58,9 @@ def make_temp_dir(where=None, prefix=None, keep=False):
@contextmanager
def open_file(args, file_name):
"""Handle creation and deletion of temporary directory."""
if args['gzip']:
if args.get('gzip'):
stream = gzip.open(file_name, 'rt')
elif args['bzip']:
elif args.get('bzip'):
stream = bz2.open(file_name, 'rt')
else:
stream = open(file_name)
Expand Down
20 changes: 10 additions & 10 deletions tests/lib/test_core_preprocessor.py
Expand Up @@ -67,11 +67,11 @@ def test_preprocess_01(
@patch('lib.db.insert_sequences_batch')
def test_load_one_file_01(insert_sequences_batch, info):
"""Load mixed sequences from a file into the atram database."""
cxn, _ = set_up()
cxn, args = set_up()
db.BATCH_SIZE = 5

file_1 = join('tests', 'data', 'load_seq1.txt')
core_preprocessor.load_one_file(cxn, file_1, 'mixed_ends')
core_preprocessor.load_one_file(args, cxn, file_1, 'mixed_ends')

msg = 'Loading "{}" into sqlite database'.format(file_1)
info.assert_called_once_with(msg)
Expand All @@ -94,11 +94,11 @@ def test_load_one_file_01(insert_sequences_batch, info):
@patch('lib.db.insert_sequences_batch')
def test_load_one_file_02(insert_sequences_batch, info):
"""Load end 1 sequences from a file into the atram database."""
cxn, _ = set_up()
cxn, args = set_up()
db.BATCH_SIZE = 5

file_1 = join('tests', 'data', 'load_seq1.txt')
core_preprocessor.load_one_file(cxn, file_1, 'end_1', '1')
core_preprocessor.load_one_file(args, cxn, file_1, 'end_1', '1')

msg = 'Loading "{}" into sqlite database'.format(file_1)
info.assert_called_once_with(msg)
Expand All @@ -121,11 +121,11 @@ def test_load_one_file_02(insert_sequences_batch, info):
@patch('lib.db.insert_sequences_batch')
def test_load_one_file_03(insert_sequences_batch, info):
"""Load end 2 sequences from a file into the atram database."""
cxn, _ = set_up()
cxn, args = set_up()
db.BATCH_SIZE = 5

file_1 = join('tests', 'data', 'load_seq1.txt')
core_preprocessor.load_one_file(cxn, file_1, 'end_2', '2')
core_preprocessor.load_one_file(args, cxn, file_1, 'end_2', '2')

msg = 'Loading "{}" into sqlite database'.format(file_1)
info.assert_called_once_with(msg)
Expand All @@ -148,12 +148,12 @@ def test_load_one_file_03(insert_sequences_batch, info):
@patch('lib.db.insert_sequences_batch')
def test_load_one_file_04(insert_sequences_batch, info):
"""Load single end sequences from a file into the atram database."""
cxn, _ = set_up()
cxn, args = set_up()
db.BATCH_SIZE = 5

file_1 = join('tests', 'data', 'load_seq1.txt')
core_preprocessor.load_one_file(
cxn, file_1, 'single_ends', '')
args, cxn, file_1, 'single_ends', '')

msg = 'Loading "{}" into sqlite database'.format(file_1)
info.assert_called_once_with(msg)
Expand All @@ -176,11 +176,11 @@ def test_load_one_file_04(insert_sequences_batch, info):
@patch('lib.db.insert_sequences_batch')
def test_load_one_file_05(insert_sequences_batch, info):
"""Load single end sequences from a file into the atram database."""
cxn, _ = set_up()
cxn, args = set_up()
db.BATCH_SIZE = 5

file_1 = join('tests', 'data', 'load_seq2.txt')
core_preprocessor.load_one_file(cxn, file_1, 'mixed_ends')
core_preprocessor.load_one_file(args, cxn, file_1, 'mixed_ends')

msg = 'Loading "{}" into sqlite database'.format(file_1)
info.assert_called_once_with(msg)
Expand Down

0 comments on commit 5b50a85

Please sign in to comment.