@@ -82,10 +82,11 @@ def _check_vm_args(name, args):
8282class AbstractPythonVm (Vm ):
8383 __metaclass__ = ABCMeta
8484
85- def __init__ (self , config_name , options = None ):
85+ def __init__ (self , config_name , options = None , env = None ):
8686 super (AbstractPythonVm , self ).__init__ ()
8787 self ._config_name = config_name
8888 self ._options = options
89+ self ._env = env
8990
9091 @property
9192 def options (self ):
@@ -124,15 +125,15 @@ def run(self, cwd, args):
124125 _check_vm_args (self .name (), args )
125126 out = mx .OutputCapture ()
126127 stdout_capture = mx .TeeOutputCapture (out )
127- ret_code = mx .run ([self .interpreter ] + args , out = stdout_capture , err = stdout_capture )
128+ ret_code = mx .run ([self .interpreter ] + args , out = stdout_capture , err = stdout_capture , env = self . _env )
128129 return ret_code , out .data
129130
130131
131132class AbstractPythonIterationsControlVm (AbstractPythonVm ):
132133 __metaclass__ = ABCMeta
133134
134- def __init__ (self , config_name , options = None , iterations = None ):
135- super (AbstractPythonIterationsControlVm , self ).__init__ (config_name , options )
135+ def __init__ (self , config_name , options = None , env = None , iterations = None ):
136+ super (AbstractPythonIterationsControlVm , self ).__init__ (config_name , options = options , env = env )
136137 try :
137138 self ._iterations = int (iterations )
138139 except :
@@ -159,8 +160,8 @@ def run(self, cwd, args):
159160class CPythonVm (AbstractPythonIterationsControlVm ):
160161 PYTHON_INTERPRETER = "python3"
161162
162- def __init__ (self , config_name , options = None , virtualenv = None , iterations = 0 ):
163- super (CPythonVm , self ).__init__ (config_name , options = options , iterations = iterations )
163+ def __init__ (self , config_name , options = None , env = None , virtualenv = None , iterations = 0 ):
164+ super (CPythonVm , self ).__init__ (config_name , options = options , env = env , iterations = iterations )
164165 self ._virtualenv = virtualenv
165166
166167 @property
@@ -176,8 +177,8 @@ def name(self):
176177class PyPyVm (AbstractPythonIterationsControlVm ):
177178 PYPY_INTERPRETER = "pypy3"
178179
179- def __init__ (self , config_name , options = None , iterations = None ):
180- super (PyPyVm , self ).__init__ (config_name , options = options , iterations = iterations )
180+ def __init__ (self , config_name , options = None , env = None , iterations = None ):
181+ super (PyPyVm , self ).__init__ (config_name , options = options , env = env , iterations = iterations )
181182
182183 @property
183184 def interpreter (self ):
0 commit comments