Robot Framework Integrated Development Environment (RIDE)
jython.py
Go to the documentation of this file.
1
# Copyright 2008-2015 Nokia Networks
2
# Copyright 2016- Robot Framework Foundation
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
7
#
8
# http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
16
import
sys
17
18
from
java.lang
import
Thread, Runnable
19
20
21
class
Timeout
():
22
23
def
__init__
(self, timeout, error):
24
self.
_timeout
_timeout = timeout
25
self.
_error
_error = error
26
27
def
execute
(self, runnable):
28
runner =
Runner
(runnable)
29
thread = Thread(runner, name=
'RobotFrameworkTimeoutThread'
)
30
thread.setDaemon(
True
)
31
thread.start()
32
thread.join(
int
(self.
_timeout
_timeout * 1000))
33
if
thread.isAlive():
34
thread.stop()
35
raise
self.
_error
_error
36
return
runner.get_result()
37
38
39
class
Runner
(Runnable):
40
41
def
__init__
(self, runnable):
42
self.
_runnable
_runnable = runnable
43
self.
_result
_result =
None
44
self.
_error
_error =
None
45
46
def
run
(self):
47
try
:
48
self.
_result
_result = self.
_runnable
_runnable()
49
except
:
50
self.
_error
_error = sys.exc_info()
51
52
def
get_result
(self):
53
if
not
self.
_error
_error:
54
return
self.
_result
_result
55
# `exec` used to avoid errors with easy_install on Python 3:
56
# https://github.com/robotframework/robotframework/issues/2785
57
exec(
'raise self._error[0], self._error[1], self._error[2]'
)
robotide.lib.robot.running.timeouts.jython.Runner
Definition:
jython.py:39
robotide.lib.robot.running.timeouts.jython.Runner._error
_error
Definition:
jython.py:44
robotide.lib.robot.running.timeouts.jython.Runner.get_result
def get_result(self)
Definition:
jython.py:52
robotide.lib.robot.running.timeouts.jython.Runner.__init__
def __init__(self, runnable)
Definition:
jython.py:41
robotide.lib.robot.running.timeouts.jython.Runner._runnable
_runnable
Definition:
jython.py:42
robotide.lib.robot.running.timeouts.jython.Runner._result
_result
Definition:
jython.py:43
robotide.lib.robot.running.timeouts.jython.Runner.run
def run(self)
Definition:
jython.py:46
robotide.lib.robot.running.timeouts.jython.Timeout
Definition:
jython.py:21
robotide.lib.robot.running.timeouts.jython.Timeout.execute
def execute(self, runnable)
Definition:
jython.py:27
robotide.lib.robot.running.timeouts.jython.Timeout._timeout
_timeout
Definition:
jython.py:24
robotide.lib.robot.running.timeouts.jython.Timeout._error
_error
Definition:
jython.py:25
robotide.lib.robot.running.timeouts.jython.Timeout.__init__
def __init__(self, timeout, error)
Definition:
jython.py:23
robotide.lib.robot.reporting.jsexecutionresult.int
int
Definition:
jsexecutionresult.py:25
src
robotide
lib
robot
running
timeouts
jython.py
Generated by
1.9.1