-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test files for each plugin and methods apart from the prepare method Some minor fixes for problems that arose from testing
- Loading branch information
Showing
22 changed files
with
2,270 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Longbow is Copyright (C) of James T Gebbie-Rayet and Gareth B Shannon 2015. | ||
# | ||
# This file is part of the Longbow software which was developed as part of the | ||
# HECBioSim project (http://www.hecbiosim.ac.uk/). | ||
# | ||
# HECBioSim facilitates and supports high-end computing within the UK | ||
# biomolecular simulation community on resources such as ARCHER. | ||
# | ||
# Longbow is free software: you can redistribute it and/or modify it under the | ||
# terms of the GNU General Public License as published by the Free Software | ||
# Foundation, either version 2 of the License, or (at your option) any later | ||
# version. | ||
# | ||
# Longbow is distributed in the hope that it will be useful, but WITHOUT ANY | ||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||
# A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along with | ||
# Longbow. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
""" | ||
This test module contains tests for the LSF scheduler plugin. | ||
""" | ||
|
||
try: | ||
|
||
from unittest import mock | ||
|
||
except ImportError: | ||
|
||
import mock | ||
|
||
import pytest | ||
|
||
import Longbow.corelibs.exceptions as exceptions | ||
import Longbow.schedulers.lsf as lsf | ||
|
||
|
||
@mock.patch('Longbow.corelibs.shellwrappers.sendtossh') | ||
def test_delete_test1(mock_ssh): | ||
|
||
""" | ||
Test if job id is grabbed. | ||
""" | ||
|
||
job = { | ||
"jobid": "12345", | ||
"replicates": "1" | ||
} | ||
|
||
mock_ssh.return_value = ("Success", "", 0) | ||
|
||
output = lsf.delete(job) | ||
|
||
args = mock_ssh.call_args[0][1] | ||
|
||
assert output == "Success" | ||
assert " ".join(args) == "bkill 12345" | ||
|
||
|
||
@mock.patch('Longbow.corelibs.shellwrappers.sendtossh') | ||
def test_delete_except1(mock_ssh): | ||
|
||
""" | ||
Test if Queuemax exception is triggered based on output from scheduler. | ||
""" | ||
|
||
job = { | ||
"jobid": "12345", | ||
"replicates": "1" | ||
} | ||
|
||
mock_ssh.side_effect = exceptions.SSHError( | ||
"Error", ("out", "", 0)) | ||
|
||
with pytest.raises(exceptions.JobdeleteError): | ||
|
||
lsf.delete(job) |
Oops, something went wrong.