Robot Framework Integrated Development Environment (RIDE)
ironpython.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
import
threading
18
19
from
System.Threading
import
Thread, ThreadStart
20
21
22
class
Timeout
():
23
24
def
__init__
(self, timeout, error):
25
self.
_timeout
_timeout = timeout
26
self.
_error
_error = error
27
28
def
execute
(self, runnable):
29
runner =
Runner
(runnable)
30
thread = Thread(ThreadStart(runner))
31
thread.IsBackground =
True
32
thread.Start()
33
if
not
thread.Join(self.
_timeout
_timeout * 1000):
34
thread.Abort()
35
raise
self.
_error
_error
36
return
runner.get_result()
37
38
39
class
Runner
():
40
41
def
__init__
(self, runnable):
42
self.
_runnable
_runnable = runnable
43
self.
_result
_result =
None
44
self.
_error
_error =
None
45
46
def
__call__
(self):
47
threading.currentThread().setName(
'RobotFrameworkTimeoutThread'
)
48
try
:
49
self.
_result
_result = self.
_runnable
_runnable()
50
except
:
51
self.
_error
_error = sys.exc_info()
52
53
def
get_result
(self):
54
if
not
self.
_error
_error:
55
return
self.
_result
_result
56
# `exec` used to avoid errors with easy_install on Python 3:
57
# https://github.com/robotframework/robotframework/issues/2785
58
exec(
'raise self._error[0], self._error[1], self._error[2]'
)
robotide.lib.robot.running.timeouts.ironpython.Runner
Definition:
ironpython.py:39
robotide.lib.robot.running.timeouts.ironpython.Runner._error
_error
Definition:
ironpython.py:44
robotide.lib.robot.running.timeouts.ironpython.Runner.get_result
def get_result(self)
Definition:
ironpython.py:53
robotide.lib.robot.running.timeouts.ironpython.Runner.__call__
def __call__(self)
Definition:
ironpython.py:46
robotide.lib.robot.running.timeouts.ironpython.Runner.__init__
def __init__(self, runnable)
Definition:
ironpython.py:41
robotide.lib.robot.running.timeouts.ironpython.Runner._result
_result
Definition:
ironpython.py:43
robotide.lib.robot.running.timeouts.ironpython.Runner._runnable
_runnable
Definition:
ironpython.py:42
robotide.lib.robot.running.timeouts.ironpython.Timeout
Definition:
ironpython.py:22
robotide.lib.robot.running.timeouts.ironpython.Timeout._timeout
_timeout
Definition:
ironpython.py:25
robotide.lib.robot.running.timeouts.ironpython.Timeout.__init__
def __init__(self, timeout, error)
Definition:
ironpython.py:24
robotide.lib.robot.running.timeouts.ironpython.Timeout._error
_error
Definition:
ironpython.py:26
robotide.lib.robot.running.timeouts.ironpython.Timeout.execute
def execute(self, runnable)
Definition:
ironpython.py:28
src
robotide
lib
robot
running
timeouts
ironpython.py
Generated by
1.9.1