Skip to content

Commit

Permalink
clean ups
Browse files Browse the repository at this point in the history
  • Loading branch information
Jessica Mizzi committed Mar 6, 2015
1 parent 0130f44 commit d0cc0b0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
4 changes: 2 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
2015-03-06 Jessica Mizzi <mizzijes@msu.edu>

* khmer/kfile.py: Added file not existing error for system exit
* tests/{test_scripts,test_functions}.py: Added tests for
check_file_status for file existence and force option
* tests/{test_scripts,test_functions}.py: Added tests for
check_file_status for file existence and force option

2015-03-06 Titus Brown <titus@idyll.org>

Expand Down
4 changes: 2 additions & 2 deletions khmer/kfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def check_file_status(file_path, force):
AND if the file is NOT a fifo/block/named pipe then a warning is printed
and sys.exit(1) is called
"""
mode = None
mode = None

if file_path is '-':
return
Expand All @@ -28,7 +28,7 @@ def check_file_status(file_path, force):
except OSError:
print >>sys.stderr, "ERROR: Input file %s does not exist" % \
file_path

if not force:
print >>sys.stderr, "Exiting"
sys.exit(1)
Expand Down
19 changes: 2 additions & 17 deletions tests/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ def test_check_file_status_kfile():
check_file_status_exited = False
try:
check_file_status(fn, False)
except SystemExit:
except SystemExit:
check_file_status_exited = True
assert check_file_status_exited


def test_check_file_status_kfile_force():
fn = utils.get_temp_filename('thisfiledoesnotexist')
try:
check_file_status(fn, True)
check_file_status(fn, True)
except OSError as e:
assert False

Expand Down Expand Up @@ -318,18 +318,3 @@ def testForceSingleAndMinLength(self):
assert x == expected, x
assert m == 3, m
assert n == 2, n


def check_file_status_kfile():
try:
kfile.check_file_status('thisfiledoesnotexistatall')
except OSError as e:
print >>sys.stder, '...failed to remove {fn}'.format(fn)


def check_file_status_kfile_force():
if force:
try:
kfile.check_file_status('thisfiledoesnotexistatall')
except OSError as e:
print >>sys.stderr, '...failed to remove {fn}'.format(fn)

0 comments on commit d0cc0b0

Please sign in to comment.