2 new revisions:

Revision: 042a8f2debef
Branch:   default
Author:   Mika Hänninen <mika.hanni...@gmail.com>
Date:     Thu May 16 00:57:05 2013
Log:      process lib: refactored env handling
http://code.google.com/p/robotframework/source/detail?r=042a8f2debef

Revision: 94f668f8bea5
Branch:   default
Author:   Mika Hänninen <mika.hanni...@gmail.com>
Date:     Thu May 16 00:57:09 2013
Log:      Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=94f668f8bea5

==============================================================================
Revision: 042a8f2debef
Branch:   default
Author:   Mika Hänninen <mika.hanni...@gmail.com>
Date:     Thu May 16 00:57:05 2013
Log:      process lib: refactored env handling
http://code.google.com/p/robotframework/source/detail?r=042a8f2debef

Modified:
 /atest/testdata/standard_libraries/process/test_process_library.txt
 /src/robot/libraries/Process.py

=======================================
--- /atest/testdata/standard_libraries/process/test_process_library.txt Wed May 15 03:37:38 2013 +++ /atest/testdata/standard_libraries/process/test_process_library.txt Thu May 16 00:57:05 2013
@@ -60,21 +60,19 @@
     @{curenv}=    Get Environment Variables
     ${setenv}=    Create Dictionary           specialvar  spessu
${result}= Run Process python -c "import os; print os.environ;" shell=True
-    Log           ${result.stdout}
     Should Match Regexp        ${result.stdout}   (.*)(?i)@{curenv}[0](.*)
     Should Not Match Regexp    ${result.stdout}   (.*)(?i)specialvar(.*)
- ${result}= Run Process python -c "import os; print os.environ;" shell=True env:specialvar=spessu
-    Log           ${result.stdout}
-    Should Not Match Regexp    ${result.stdout}   (.*)(?i)@{curenv}[0](.*)
-    Should Match Regexp        ${result.stdout}   (.*)(?i)specialvar(.*)
+ ${result}= Run Process python -c "import os; print os.environ;" shell=True env:specia£var=spessu
+    Should Match Regexp        ${result.stdout}   (.*)(?i)@{curenv}[0](.*)
+    Should Match Regexp        ${result.stdout}   (.*)(?i)specia(.*)var(.*)
${result}= Run Process python -c "import os; print os.environ;" shell=True env=${setenv}
     Should Not Match Regexp    ${result.stdout}   (.*)(?i)@{curenv}[0](.*)
     Should Match Regexp        ${result.stdout}   (.*)(?i)specialvar(.*)

 Setting Environment With Multiple Values
     @{curenv}=    Get Environment Variables
- ${result}= Run Process python -c "import os; print os.environ;" shell=True env:specialvar=spessu env:diiba=daaba
-    Should Not Match Regexp   ${result.stdout}   (.*)(?i)@{curenv}[0](.*)
+ ${result}= Run Process python -c "import os; print os.environ;" shell=True env:specialvar=spessu env:diiba=da£ba
+    Should Match Regexp       ${result.stdout}   (.*)(?i)@{curenv}[0](.*)
     Should Match Regexp       ${result.stdout}   (.*)(?i)specialvar(.*)
     Should Match Regexp       ${result.stdout}   (.*)(?i)diiba(.*)

@@ -87,7 +85,7 @@
     Should Match Regexp        ${result.stdout}   (.*)(?i)diiba(.*)

 Unsupported Arguments Should Cause Error
-    ${setenv}=    Create Dictionary           specialvar  spessu
+    ${setenv}=    Create Dictionary           sp  spessu
Run Keyword And Expect Error UnrecognizedParameterError: * Run Process python -c "import os; print os.environ;" shell=True genv=${setenv} Run Keyword And Expect Error UnrecognizedParameterError: * Run Process python -c "import os; print os.environ;" shellx=True

=======================================
--- /src/robot/libraries/Process.py     Wed May 15 07:24:36 2013
+++ /src/robot/libraries/Process.py     Thu May 16 00:57:05 2013
@@ -476,21 +476,27 @@
     def _handle_rest(self, rest):
         if not rest:
             return
-        must_values = dict()
-        if sys.platform == "win32":
-            must_values['COMSPEC'] = os.environ['COMSPEC']
-            must_values['PATH'] = os.environ['PATH']
+        self.env = self._construct_env(rest)
+
+    def _construct_env(self, rest):
         new_env = dict()
         for key,val in rest.iteritems():
-            key = str(key)
+            key = key.encode('utf-8')
             if key == "env":
                 self.env = dict()
                 for k,v in val.iteritems():
-                    self.env[str(k)] = str(v)
-            elif "env:" in key[:4]:
-                new_env[key[4:]] = str(val)
+                    self.env[k.encode('utf-8')] = v.encode('utf-8')
+            elif "env:" == key[:4]:
+                new_env[key[4:]] = val.encode('utf-8')
             else:
raise UnrecognizedParameterError("'%s' is not supported by this keyword." % key )
         if not self.env:
-            self.env = new_env
-        self.env = dict(must_values.items() + self.env.items())
+            return dict(new_env.items() + os.environ.copy().items())
+        return dict(self._must_env_values().items() + self.env.items())
+
+    def _must_env_values(self):
+        must_values = {}
+        if sys.platform == "win32":
+            must_values['COMSPEC'] = os.environ['COMSPEC']
+            must_values['PATH'] = os.environ['PATH']
+        return must_values

==============================================================================
Revision: 94f668f8bea5
Branch:   default
Author:   Mika Hänninen <mika.hanni...@gmail.com>
Date:     Thu May 16 00:57:09 2013
Log:      Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=94f668f8bea5


--

--- 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.


Reply via email to