Revision: 4d1636ebe72d
Branch:   default
Author:   Mika Hänninen <[email protected]>
Date:     Thu May 16 05:55:19 2013
Log:      process preference tweak
http://code.google.com/p/robotframework/source/detail?r=4d1636ebe72d

Added:
 /atest/testdata/standard_libraries/process/CustomLib.py
Modified:
 /atest/testdata/standard_libraries/process/start_process_preferences.txt
 /src/robot/running/namespace.py

=======================================
--- /dev/null
+++ /atest/testdata/standard_libraries/process/CustomLib.py Thu May 16 05:55:19 2013
@@ -0,0 +1,4 @@
+class CustomLib:
+
+    def get_process_id(self):
+        return "The Pid"
=======================================
--- /atest/testdata/standard_libraries/process/start_process_preferences.txt Tue May 14 03:15:17 2013 +++ /atest/testdata/standard_libraries/process/start_process_preferences.txt Thu May 16 05:55:19 2013
@@ -2,6 +2,7 @@
 Suite Setup       Check Preconditions
 Library           Process
 Library           OperatingSystem
+Library           CustomLib.py
 Resource          resource.txt

 *** Test Cases ***
@@ -16,6 +17,9 @@
 Implicitly run Process library keyword
${handle}= Start Process python -c "import os; print os.path.abspath(os.curdir);" shell=True
     ${out}=        Wait For Process
+ ${out2}= Get Process Id # Should call CustomLib keyword
+    Should Match   ${out2}    The Pid
+ ${items}= Count Items In Directory ${CURDIR} # OperatingSystem keywords should be reachable

Implicitly run Operating System library keyword when library search order is set
     Set Library Search Order     OperatingSystem
=======================================
--- /src/robot/running/namespace.py     Wed May 15 04:51:47 2013
+++ /src/robot/running/namespace.py     Thu May 16 05:55:19 2013
@@ -339,12 +339,10 @@
         return handlers

     def _prefer_process_over_operatingsystem(self, handler1, handler2):
-        if handler1.library.orig_name == "Process":
-            return [handler1]
-        elif handler2.library.orig_name == "Process":
-            return [handler2]
-        else:
-            return [handler1, handler2]
+ handlers = {handler1.library.orig_name:handler1, handler2.library.orig_name:handler2}
+        if set(handlers.keys()) == set(['Process', 'OperatingSystem']):
+            return [handlers['Process']]
+        return [handler1, handler2]

     def _filter_stdlib_handler(self, handler1, handler2):
         if handler1.library.orig_name in STDLIB_NAMES:

--

--- 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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to