Package list python-procrunner / 8a2d486
convert environment variable values to strings Markus Gerstel 3 years ago
2 changed file(s) with 3 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
321321 env = os.environ
322322 if environment_override:
323323 env = copy.copy(env)
324 env.update(environment_override)
324 env.update({key: str(env[key]) for key in environment_override})
325325
326326 if win32resolve and sys.platform == 'win32':
327327 command = _windows_resolve(command)
8888 def test_pass_custom_environment_to_process_and_add_another_value(mock_subprocess):
8989 mock_subprocess.Popen.side_effect = NotImplementedError() # cut calls short
9090 mock_env1 = { 'keyA': mock.sentinel.keyA }
91 mock_env2 = { 'keyB': str(mock.sentinel.keyB) }
91 mock_env2 = { 'keyB': mock.sentinel.keyB, 'number': 5 }
9292 # Pass an environment dictionary
9393 with pytest.raises(NotImplementedError):
9494 procrunner.run(mock.Mock(), -1, False, environment=copy.copy(mock_env1), environment_override=copy.copy(mock_env2))
9595 mock_env_sum = copy.copy(mock_env1)
96 mock_env_sum.update(mock_env2)
96 mock_env_sum.update({key: str(mock_env2[key]) for key in mock_env2})
9797 assert mock_subprocess.Popen.call_args[1]['env'] == mock_env_sum
9898
9999