Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.core
Commits
bbd36507
Commit
bbd36507
authored
Jun 26, 2020
by
Samuel GAIST
Browse files
[test][execution] Ensure that writing to a non existing output shows an error
parent
9af90457
Pipeline
#40747
failed with stage
in 16 minutes and 53 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
beat/core/test/prefix/algorithms/errors/write_in_wrong_output_aut/1.json
0 → 100644
View file @
bbd36507
{
"schema_version"
:
2
,
"language"
:
"python"
,
"api_version"
:
2
,
"type"
:
"autonomous"
,
"splittable"
:
false
,
"parameters"
:
{
"offset"
:
{
"default"
:
32
,
"type"
:
"int32"
}
},
"groups"
:
[
{
"name"
:
"main"
,
"inputs"
:
{
"in_data"
:
{
"type"
:
"user/single_integer/1"
}
},
"outputs"
:
{
"out_data"
:
{
"type"
:
"user/single_integer/1"
}
}
}
]
}
beat/core/test/prefix/algorithms/errors/write_in_wrong_output_aut/1.py
0 → 100644
View file @
bbd36507
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
###################################################################################
# #
# Copyright (c) 2020 Idiap Research Institute, http://www.idiap.ch/ #
# Contact: beat.support@idiap.ch #
# #
# Redistribution and use in source and binary forms, with or without #
# modification, are permitted provided that the following conditions are met: #
# #
# 1. Redistributions of source code must retain the above copyright notice, this #
# list of conditions and the following disclaimer. #
# #
# 2. Redistributions in binary form must reproduce the above copyright notice, #
# this list of conditions and the following disclaimer in the documentation #
# and/or other materials provided with the distribution. #
# #
# 3. Neither the name of the copyright holder nor the names of its contributors #
# may be used to endorse or promote products derived from this software without #
# specific prior written permission. #
# #
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED #
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE #
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE #
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL #
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR #
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER #
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, #
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE #
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
# #
###################################################################################
class
Algorithm
:
def
__init__
(
self
):
self
.
offset
=
1
def
setup
(
self
,
parameters
):
self
.
offset
=
parameters
[
"offset"
]
return
True
def
process
(
self
,
data_loaders
,
outputs
):
input_name
=
"in_data"
data_loader
=
data_loaders
.
loaderOf
(
input_name
)
for
i
in
range
(
data_loader
.
count
(
input_name
)):
view
=
data_loader
.
view
(
input_name
,
i
)
(
data
,
start
,
end
)
=
view
[
view
.
count
()
-
1
]
outputs
[
"wrong_output"
].
write
(
{
"value"
:
data
[
"in_data"
].
value
+
self
.
offset
},
end
)
return
True
beat/core/test/prefix/algorithms/errors/write_in_wrong_output_seq/1.json
0 → 100644
View file @
bbd36507
{
"schema_version"
:
2
,
"language"
:
"python"
,
"api_version"
:
2
,
"type"
:
"sequential"
,
"splittable"
:
false
,
"parameters"
:
{
"offset"
:
{
"default"
:
32
,
"type"
:
"int32"
}
},
"groups"
:
[
{
"name"
:
"main"
,
"inputs"
:
{
"in_data"
:
{
"type"
:
"user/single_integer/1"
}
},
"outputs"
:
{
"out_data"
:
{
"type"
:
"user/single_integer/1"
}
}
}
]
}
beat/core/test/prefix/algorithms/errors/write_in_wrong_output_seq/1.py
0 → 100644
View file @
bbd36507
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
###################################################################################
# #
# Copyright (c) 2020 Idiap Research Institute, http://www.idiap.ch/ #
# Contact: beat.support@idiap.ch #
# #
# Redistribution and use in source and binary forms, with or without #
# modification, are permitted provided that the following conditions are met: #
# #
# 1. Redistributions of source code must retain the above copyright notice, this #
# list of conditions and the following disclaimer. #
# #
# 2. Redistributions in binary form must reproduce the above copyright notice, #
# this list of conditions and the following disclaimer in the documentation #
# and/or other materials provided with the distribution. #
# #
# 3. Neither the name of the copyright holder nor the names of its contributors #
# may be used to endorse or promote products derived from this software without #
# specific prior written permission. #
# #
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED #
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE #
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE #
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL #
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR #
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER #
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, #
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE #
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
# #
###################################################################################
class
Algorithm
:
def
__init__
(
self
):
self
.
offset
=
1
def
setup
(
self
,
parameters
):
self
.
offset
=
parameters
[
"offset"
]
return
True
def
process
(
self
,
inputs
,
data_loaders
,
outputs
):
outputs
[
"wrong_output"
].
write
(
{
"value"
:
inputs
[
"in_data"
].
data
.
value
+
self
.
offset
}
)
return
True
beat/core/test/prefix/experiments/errors/user/single/1/write_in_wrong_output_aut.json
0 → 100644
View file @
bbd36507
{
"analyzers"
:
{
"analysis"
:
{
"algorithm"
:
"v1/integers_echo_analyzer/1"
,
"inputs"
:
{
"in_data"
:
"in"
}
}
},
"blocks"
:
{
"echo"
:
{
"algorithm"
:
"errors/write_in_wrong_output_aut/1"
,
"inputs"
:
{
"in_data"
:
"in"
},
"outputs"
:
{
"out_data"
:
"out"
}
}
},
"datasets"
:
{
"set"
:
{
"database"
:
"simple/1"
,
"protocol"
:
"protocol"
,
"set"
:
"set"
}
},
"globals"
:
{
"queue"
:
"queue"
,
"environment"
:
{
"name"
:
"Python for tests"
,
"version"
:
"1.3.0"
},
"errors/write_in_wrong_output_aut/1"
:
{
"offset"
:
1
}
}
}
beat/core/test/prefix/experiments/errors/user/single/1/write_in_wrong_output_aut.rst
0 → 100644
View file @
bbd36507
Write on a wrong output on purpose in autonomous mode.
beat/core/test/prefix/experiments/errors/user/single/1/write_in_wrong_output_seq.json
0 → 100644
View file @
bbd36507
{
"analyzers"
:
{
"analysis"
:
{
"algorithm"
:
"v1/integers_echo_analyzer/1"
,
"inputs"
:
{
"in_data"
:
"in"
}
}
},
"blocks"
:
{
"echo"
:
{
"algorithm"
:
"errors/write_in_wrong_output_seq/1"
,
"inputs"
:
{
"in_data"
:
"in"
},
"outputs"
:
{
"out_data"
:
"out"
}
}
},
"datasets"
:
{
"set"
:
{
"database"
:
"simple/1"
,
"protocol"
:
"protocol"
,
"set"
:
"set"
}
},
"globals"
:
{
"queue"
:
"queue"
,
"environment"
:
{
"name"
:
"Python for tests"
,
"version"
:
"1.3.0"
},
"errors/write_in_wrong_output_seq/1"
:
{
"offset"
:
1
}
}
}
beat/core/test/prefix/experiments/errors/user/single/1/write_in_wrong_output_seq.rst
0 → 100644
View file @
bbd36507
Write on a wrong output on purpose in sequential mode.
beat/core/test/test_execution.py
View file @
bbd36507
...
...
@@ -415,6 +415,28 @@ class BaseExecutionMixIn(object):
)
)
@
slow
def
test_single_1_write_in_wrong_output_seq
(
self
):
result
=
self
.
execute
(
"errors/user/single/1/write_in_wrong_output_seq"
,
[
None
])
nose
.
tools
.
assert_true
(
result
)
nose
.
tools
.
assert_not_equal
(
result
[
"status"
],
0
)
nose
.
tools
.
assert_true
(
result
[
"user_error"
])
error_message
=
result
[
"user_error"
].
replace
(
"
\\
'"
,
"'"
)
nose
.
tools
.
assert_true
(
"'NoneType' object has no attribute 'write'"
in
error_message
)
@
slow
def
test_single_1_write_in_wrong_output_aut
(
self
):
result
=
self
.
execute
(
"errors/user/single/1/write_in_wrong_output_aut"
,
[
None
])
nose
.
tools
.
assert_true
(
result
)
nose
.
tools
.
assert_not_equal
(
result
[
"status"
],
0
)
nose
.
tools
.
assert_true
(
result
[
"user_error"
])
error_message
=
result
[
"user_error"
].
replace
(
"
\\
'"
,
"'"
)
nose
.
tools
.
assert_true
(
"'NoneType' object has no attribute 'write'"
in
error_message
)
# For benchmark purposes
# @slow
# def test_double_1_large(self):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment