Commit 23a16eed authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[test][execution] Implement test for setup error

parent 70d9f3c1
Pipeline #24093 passed with stages
in 30 minutes and 5 seconds
{
"language": "python",
"splittable": true,
"api_version": 2,
"groups": [
{
"name": "main",
"inputs": {
"in_data": {
"type": "user/single_integer/1"
}
},
"outputs": {
"out_data": {
"type": "user/single_integer/1"
}
}
}
]
}
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
###############################################################################
# #
# Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ #
# Contact: beat.support@idiap.ch #
# #
# This file is part of the beat.core module of the BEAT platform. #
# #
# Commercial License Usage #
# Licensees holding valid commercial BEAT licenses may use this file in #
# accordance with the terms contained in a written agreement between you #
# and Idiap. For further information contact tto@idiap.ch #
# #
# Alternatively, this file may be used under the terms of the GNU Affero #
# Public License version 3 as published by the Free Software and appearing #
# in the file LICENSE.AGPL included in the packaging of this file. #
# The BEAT platform 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. #
# #
# You should have received a copy of the GNU Affero Public License along #
# with the BEAT platform. If not, see http://www.gnu.org/licenses/. #
# #
###############################################################################
class Algorithm:
def setup(self, parameters):
return False
def process(self, inputs, outputs):
outputs['out_data'].write(inputs['in_data'].data)
return True
{
"analyzers": {
"analysis": {
"algorithm": "user/integers_echo_analyzer/1",
"inputs": {
"in_data": "in"
}
}
},
"blocks": {
"echo": {
"algorithm": "user/setup_error/1",
"inputs": {
"in_data": "in"
},
"outputs": {
"out_data": "out"
}
}
},
"datasets": {
"set": {
"database": "simple/1",
"protocol": "protocol",
"set": "set"
}
},
"globals": {
"queue": "queue",
"environment": {
"name": "Python 2.7",
"version": "1.3.0"
}
}
}
......@@ -87,6 +87,12 @@ class TestDockerExecution(BaseExecutionMixIn):
assert result['status'] == 1
assert result['user_error'] == "'Could not prepare algorithm (returned False)'"
@slow
def test_single_1_setup_error(self):
result = self.execute('user/user/single/1/setup_error', [None])
assert result['status'] == 1
assert result['user_error'] == "'Could not setup algorithm (returned False)'"
# NOT COMPATIBLE YET WITH THE NEW API
# @slow
......
......@@ -310,6 +310,13 @@ class TestLocalExecution(BaseExecutionMixIn):
assert 'Algorithm prepare failed' in context.exception
@slow
def test_single_1_setup_error(self):
with nose.tools.assert_raises(RuntimeError) as context:
result = self.execute('user/user/single/1/setup_error', [None])
assert 'Algorithm setup failed' in context.exception
#----------------------------------------------------------
......@@ -328,3 +335,10 @@ class TestSubprocessExecution(BaseExecutionMixIn):
assert result['status'] == 1
assert result['user_error'] == "'Could not prepare algorithm (returned False)'"
@slow
def test_single_1_setup_error(self):
result = self.execute('user/user/single/1/setup_error', [None])
assert result['status'] == 1
assert result['user_error'] == "'Could not setup algorithm (returned False)'"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment