Revision: 56dbf430cbe6
Branch: default
Author: Mika Hänninen <mika.hanni...@gmail.com>
Date: Tue Jun 11 01:34:12 2013
Log: process lib: fix no active process issues
http://code.google.com/p/robotframework/source/detail?r=56dbf430cbe6
Added:
/atest/robot/standard_libraries/process/no_active_process.txt
/atest/testdata/standard_libraries/process/no_active_process.txt
Modified:
/atest/testdata/standard_libraries/process/process_library.txt
/src/robot/libraries/Process.py
=======================================
--- /dev/null
+++ /atest/robot/standard_libraries/process/no_active_process.txt Tue Jun
11 01:34:12 2013
@@ -0,0 +1,14 @@
+*** Settings ***
+Suite Setup Run Tests ${EMPTY}
standard_libraries/process/no_active_process.txt
+Force Tags regression pybot jybot
+Resource atest_resource.txt
+
+*** Test Cases ***
+No active process
+ Check Test Case ${TESTNAME}
+
+No active process after run process
+ Check Test Case ${TESTNAME}
+
+Invalid handle
+ Check Test Case ${TESTNAME}
=======================================
--- /dev/null
+++ /atest/testdata/standard_libraries/process/no_active_process.txt Tue
Jun 11 01:34:12 2013
@@ -0,0 +1,16 @@
+*** Settings ***
+Library Process
+
+*** Test Cases ***
+No active process
+ [Documentation] FAIL No active process.
+ Wait For Process
+
+No active process after run process
+ [Documentation] FAIL No active process.
+ Run Process echo hello shell=True
+ Wait For Process
+
+Invalid handle
+ [Documentation] FAIL Non-existing index or alias 'non_existing'.
+ Wait For Process non_existing
=======================================
--- /atest/testdata/standard_libraries/process/process_library.txt Mon Jun
10 23:07:39 2013
+++ /atest/testdata/standard_libraries/process/process_library.txt Tue Jun
11 01:34:12 2013
@@ -158,6 +158,7 @@
${result}= Run Process python -c 1/0 stderr=PIPE
Should Match ${result.stderr} *ZeroDivisionError*
+
*** Keywords ***
Restart Suite Process If Needed
${alive}= Is Process Running suite_process
=======================================
--- /src/robot/libraries/Process.py Tue Jun 11 00:38:35 2013
+++ /src/robot/libraries/Process.py Tue Jun 11 01:34:12 2013
@@ -282,8 +282,8 @@
finally:
if active_process_index is not None:
self._started_processes.switch(active_process_index)
-
- # TODO: Apparently the process is still left to the cache
+ else:
+ self._started_processes.empty_cache()
def start_process(self, command, *arguments, **configuration):
"""Starts a new process on background.
@@ -454,9 +454,10 @@
self._started_processes.switch(handle)
def _process(self, handle):
- # TODO: Handle errors when using invalid handle or when no
processes running.
if handle:
return self._started_processes.get_connection(handle)
+ if self._started_processes.current_index is None:
+ raise RuntimeError("No active process.")
return self._started_processes.current
@@ -499,7 +500,7 @@
self._stderr = self._construct_stderr()
if self._stderr.endswith('\n'):
self._stderr = self._stderr[:-1]
- return self._stderr
+ return decode_from_system(self._stderr)
def _construct_stderr(self):
if self.stderr_path == subprocess.STDOUT:
@@ -509,12 +510,17 @@
with open(self.stderr_path, 'r') as f:
return f.read()
- # TODO: attribute names are wrong. should also somehow show that
stdout and stderr are available
def __str__(self):
return """\
-stdout_name : %s
-stderr_name : %s
-exit_code : %d""" % (self.stdout_path, self.stderr_path, self.rc)
+stdout_path : %s
+stdout : %s
+stderr_path : %s
+stderr : %s
+rc : %d""" % (self.stdout_path if self.stdout_path else "PIPE",
+ type(self.stdout),
+ self.stderr_path if self.stderr_path else "PIPE",
+ type(self.stderr),
+ self.rc)
class ProcessConfig(object):
--
---
You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.