2 new revisions:
Revision: 74e7f5ec655d
Author: Pekka Klärck
Date: Wed Sep 21 04:09:50 2011
Log: rm empty line at end
http://code.google.com/p/robotframework/source/detail?r=74e7f5ec655d
Revision: 44a18deefb41
Author: Pekka Klärck
Date: Wed Sep 21 04:52:47 2011
Log: made OutputCapture a context manager
http://code.google.com/p/robotframework/source/detail?r=44a18deefb41
==============================================================================
Revision: 74e7f5ec655d
Author: Pekka Klärck
Date: Wed Sep 21 04:09:50 2011
Log: rm empty line at end
http://code.google.com/p/robotframework/source/detail?r=74e7f5ec655d
Modified:
/src/robot/result/parsingcontext.py
=======================================
--- /src/robot/result/parsingcontext.py Tue Jul 26 05:04:16 2011
+++ /src/robot/result/parsingcontext.py Wed Sep 21 04:09:50 2011
@@ -265,4 +265,3 @@
def dump(self):
return [item[0] for item in sorted(self.texts.iteritems(),
key=itemgetter(1))]
-
==============================================================================
Revision: 44a18deefb41
Author: Pekka Klärck
Date: Wed Sep 21 04:52:47 2011
Log: made OutputCapture a context manager
http://code.google.com/p/robotframework/source/detail?r=44a18deefb41
Modified:
/src/robot/running/handlers.py
/src/robot/running/outputcapture.py
/src/robot/running/testlibraries.py
=======================================
--- /src/robot/running/handlers.py Fri Sep 16 07:12:00 2011
+++ /src/robot/running/handlers.py Wed Sep 21 04:52:47 2011
@@ -12,8 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import inspect
-import sys
+from __future__ import with_statement
from robot import utils
from robot.errors import DataError
@@ -128,11 +127,8 @@
return lambda: handler(*positional, **named)
def _run_with_output_captured_and_signal_monitor(self, runner,
context):
- capturer = OutputCapturer()
- try:
+ with OutputCapturer():
return self._run_with_signal_monitoring(runner, context)
- finally:
- capturer.release_and_log()
def _run_with_signal_monitoring(self, runner, context):
try:
=======================================
--- /src/robot/running/outputcapture.py Mon Jul 11 14:30:21 2011
+++ /src/robot/running/outputcapture.py Wed Sep 21 04:52:47 2011
@@ -28,6 +28,13 @@
self._java_out = _JavaCapturer(stdout=True)
self._java_err = _JavaCapturer(stdout=False)
+ def __enter__(self):
+ return self
+
+ def __exit__(self, exc_type, exc_value, exc_trace):
+ self.release_and_log()
+ return False
+
def release_and_log(self):
stdout, stderr = self._release()
if stdout:
=======================================
--- /src/robot/running/testlibraries.py Fri Sep 16 03:36:56 2011
+++ /src/robot/running/testlibraries.py Wed Sep 21 04:52:47 2011
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import with_statement
import os
import inspect
@@ -31,11 +32,8 @@
def TestLibrary(name, args=None, variables=None, create_handlers=True):
- capturer = OutputCapturer(library_import=True)
- try:
+ with OutputCapturer(library_import=True):
libcode, source = utils.import_(name)
- finally:
- capturer.release_and_log()
libclass = _get_lib_class(libcode)
lib = libclass(libcode, source, name, args or [], variables)
if create_handlers: