Revision: 3206
Author: janne.t.harkonen
Date: Thu May  6 00:18:28 2010
Log: Moved signal handler to running
http://code.google.com/p/robotframework/source/detail?r=3206

Added:
 /trunk/src/robot/running/signalhandler.py
Deleted:
 /trunk/src/robot/utils/signalhandler.py
Modified:
 /trunk/src/robot/__init__.py
 /trunk/src/robot/running/__init__.py
 /trunk/src/robot/running/handlers.py
 /trunk/src/robot/running/timeouts.py

=======================================
--- /dev/null
+++ /trunk/src/robot/running/signalhandler.py   Thu May  6 00:18:28 2010
@@ -0,0 +1,55 @@
+#  Copyright 2008-2009 Nokia Siemens Networks Oyj
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+import signal
+import sys
+
+from robot.errors import ExecutionFailed
+
+
+class _StopSignalMonitor(object):
+
+    def __init__(self):
+        self._signal_count = 0
+        self._running_keyword = False
+        self._error_reported = False
+
+    def __call__(self,signum, frame):
+        self._signal_count += 1
+        if self._signal_count > 1:
+            sys.__stderr__.write('Execution forcefully stopped.')
+            raise SystemExit()
+        sys.__stderr__.write('Second signal will force exit.')
+        if self._running_keyword and not sys.platform.startswith('java'):
+            self._stop_execution_gracefully()
+
+    def _stop_execution_gracefully(self):
+        if not self._error_reported:
+            self._error_reported = True
+ raise ExecutionFailed('Execution terminated by signal', exit=True)
+
+    def start(self):
+        signal.signal(signal.SIGINT, self)
+        signal.signal(signal.SIGTERM, self)
+
+    def start_running_keyword(self):
+        self._running_keyword = True
+        if self._signal_count:
+            self._stop_execution_gracefully()
+
+    def stop_running_keyword(self):
+        self._running_keyword = False
+
+
+STOP_SIGNAL_MONITOR = _StopSignalMonitor()
=======================================
--- /trunk/src/robot/utils/signalhandler.py     Mon May  3 06:26:55 2010
+++ /dev/null
@@ -1,55 +0,0 @@
-#  Copyright 2008-2009 Nokia Siemens Networks Oyj
-#
-#  Licensed under the Apache License, Version 2.0 (the "License");
-#  you may not use this file except in compliance with the License.
-#  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-
-import signal
-import sys
-
-from robot.errors import ExecutionFailed
-
-
-class _StopSignalMonitor(object):
-
-    def __init__(self):
-        self._signal_count = 0
-        self._running_keyword = False
-        self._error_reported = False
-
-    def __call__(self,signum, frame):
-        self._signal_count += 1
-        if self._signal_count > 1:
-            sys.__stderr__.write('Execution forcefully stopped.')
-            raise SystemExit()
-        sys.__stderr__.write('Second signal will force exit.')
-        if self._running_keyword and not sys.platform.startswith('java'):
-            self._stop_execution_gracefully()
-
-    def _stop_execution_gracefully(self):
-        if not self._error_reported:
-            self._error_reported = True
- raise ExecutionFailed('Execution terminated by signal', exit=True)
-
-    def start(self):
-        signal.signal(signal.SIGINT, self)
-        signal.signal(signal.SIGTERM, self)
-
-    def start_running_keyword(self):
-        self._running_keyword = True
-        if self._signal_count:
-            self._stop_execution_gracefully()
-
-    def stop_running_keyword(self):
-        self._running_keyword = False
-
-
-STOP_SIGNAL_MONITOR = _StopSignalMonitor()
=======================================
--- /trunk/src/robot/__init__.py        Tue Apr 27 03:45:29 2010
+++ /trunk/src/robot/__init__.py        Thu May  6 00:18:28 2010
@@ -22,13 +22,13 @@
     import pythonpathsetter
 from output import Output, CommandLineMonitor, LOGGER
 from conf import RobotSettings, RebotSettings
-from running import TestSuite
+from running import TestSuite, STOP_SIGNAL_MONITOR
from serializing import RobotTestOutput, RebotTestOutput, SplitIndexTestOutput
 from errors import DataError, Information, XmlParsingError, INFO_PRINTED, \
         DATA_ERROR, STOPPED_BY_USER, FRAMEWORK_ERROR
 from variables import init_global_variables
 import utils
-from utils.signalhandler import STOP_SIGNAL_MONITOR
+

 __version__ = utils.version

=======================================
--- /trunk/src/robot/running/__init__.py        Tue Mar 23 04:15:41 2010
+++ /trunk/src/robot/running/__init__.py        Thu May  6 00:18:28 2010
@@ -18,6 +18,7 @@
 from testlibraries import TestLibrary
 from userkeyword import PublicUserLibrary as UserLibrary
 from runkwregister import RUN_KW_REGISTER
+from signalhandler import STOP_SIGNAL_MONITOR


 class _Namespaces:
=======================================
--- /trunk/src/robot/running/handlers.py        Tue Apr 27 05:57:54 2010
+++ /trunk/src/robot/running/handlers.py        Thu May  6 00:18:28 2010
@@ -20,7 +20,7 @@
 from arguments import PythonKeywordArguments, JavaKeywordArguments, \
     DynamicKeywordArguments, PythonInitArguments, JavaInitArguments, \
     RunKeywordArguments
-from robot.utils.signalhandler import STOP_SIGNAL_MONITOR
+from signalhandler import STOP_SIGNAL_MONITOR


 if utils.is_jython:
=======================================
--- /trunk/src/robot/running/timeouts.py        Tue Apr 27 05:57:54 2010
+++ /trunk/src/robot/running/timeouts.py        Thu May  6 00:18:28 2010
@@ -15,10 +15,11 @@
 import time

 from robot import utils
-from robot.utils.signalhandler import STOP_SIGNAL_MONITOR
 from robot.utils.robotthread import Thread, Runner, Event
 from robot.errors import TimeoutError, DataError, FrameworkError

+from signalhandler import STOP_SIGNAL_MONITOR
+

 class _Timeout:
     _defaults = ('', -1, None)

Reply via email to