-
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.
New method _flagvalidator() and tests - this method is to separate out the logic for validating command-line flags for future expansion. New method _proccommandline() and tests - this method is to separate out the logic for choosing which command-line processor to use. This is to simplify unit testing.
- Loading branch information
Showing
3 changed files
with
317 additions
and
64 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# 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 testing module contains the tests for the applications module methods. | ||
""" | ||
|
||
import pytest | ||
|
||
import Longbow.corelibs.applications as apps | ||
import Longbow.corelibs.exceptions as ex | ||
|
||
|
||
def test_flagvalidator_pass(): | ||
|
||
"""Test that the flag test passes if correct.""" | ||
|
||
foundflags = ["-c", "-i", "-p"] | ||
|
||
job = { | ||
"executable": "pmemd.MPI" | ||
} | ||
|
||
apps._flagvalidator(job, foundflags) | ||
|
||
|
||
def test_flagvalidator_fail(): | ||
|
||
"""Test that the flag test fails with exception if not correct.""" | ||
|
||
foundflags = ["-c", "-i"] | ||
|
||
job = { | ||
"executable": "pmemd.MPI", | ||
"jobname": "jobone" | ||
} | ||
|
||
with pytest.raises(ex.RequiredinputError): | ||
|
||
apps._flagvalidator(job, foundflags) | ||
|
||
|
||
def test_flagvalidator_ortest(): | ||
|
||
"""Test that cases with -flag || --flag work.""" | ||
|
||
foundflags = ["-deffnm"] | ||
|
||
job = { | ||
"executable": "mdrun" | ||
} | ||
|
||
apps._flagvalidator(job, foundflags) |
Oops, something went wrong.