-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Start of issue 718, file not existing clean up #772
Changes from all commits
1ec4e77
717876f
6734c5a
afee1fd
3259bcd
67d96a0
d406716
90efff9
412cc33
7c02e57
a7e0205
0130f44
d0cc0b0
8627ecd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2814,3 +2814,15 @@ def test_roundtrip_casava_format_2(): | |
r = open(infile).read() | ||
r2 = open(outfile).read() | ||
assert r == r2, (r, r2) | ||
|
||
|
||
def test_existance_failure(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You didn't run a spellchecker :) |
||
expected_output = 'ERROR: Input file' | ||
|
||
args = [utils.get_temp_filename('thisfiledoesnotexistatall')] | ||
|
||
status, out, err = utils.runscript( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test should specifically test the changes you made to kfile.py - if you remove those changes, will this test still succeed? It doesn't look like it to me. So, I think you should actually write two tests -- one test for a script like extract-paired-reads, that tests the error message and exit status. And one test in test_script_arguments.py that runs the code in kfile directly, and verifies that behavior. Note that sys.exit raises SystemExit, so you can look for that in the test. (Let me know if you'd like me to expand on all of this!) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ctb Will the test in test_scripts.py work to as the first test you described? If I'm understanding you, there only needs to be another test in test_script_arguments.py to test the code in kfile. I would like some expansion on the test_script_arguments.py test if possible. Also - how do I a run a spell checker? Thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for running a spell checker - what editor are you using? it'll depend on that. or you can just copy/paste the code into Word... yes, I misread the test in test_scripts - it's good now! the test in test_script_arguments should be of the specific kfile function, as opposed to running a script that runs the kfile function. so, it should call kfile.check_file_status specifically, and verify that it raises a SystemExit exception when the file doesn't exist; and maybe another test to check that if you specify force, it doesn't exit; etc. Basically you should test all of the if/else paths in the code. Does that make more sense? |
||
'extract-paired-reads.py', args, fail_ok=True) | ||
assert status == 1 | ||
|
||
assert expected_output in err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generate a guaranteed-not-to-exist filename with utils.get_temp_filename('thisfiledoesnotexist')