mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #8304 from nsoranzo/remove_temp2.txt
Use temporary file for sniff tests
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
1 2
|
||||
3 4
|
||||
@@ -18,11 +18,10 @@ def assert_converts_to_1234_convert_sep2tabs(content, expected='1\t2\n3\t4\n'):
|
||||
|
||||
|
||||
def assert_converts_to_1234_convert(content, block_size=1024):
|
||||
fname = get_test_fname('temp2.txt')
|
||||
with open(fname, 'w') as fh:
|
||||
fh.write(content)
|
||||
rval = convert_newlines(fname, tmp_prefix="gxtest", tmp_dir=tempfile.gettempdir(), block_size=block_size)
|
||||
actual_contents = open(fname).read()
|
||||
with tempfile.NamedTemporaryFile(delete=False, mode='w') as tf:
|
||||
tf.write(content)
|
||||
rval = convert_newlines(tf.name, tmp_prefix="gxtest", tmp_dir=tempfile.gettempdir(), block_size=block_size)
|
||||
actual_contents = open(tf.name).read()
|
||||
assert '1 2\n3 4\n' == actual_contents, actual_contents
|
||||
assert rval == (2, None), "rval != %s for %s" % (rval, content)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user