@@ -83,10 +83,11 @@ def _check_vm_args(name, args):
8383class AbstractPythonVm (Vm ):
8484 __metaclass__ = ABCMeta
8585
86- def __init__ (self , config_name , options = None ):
86+ def __init__ (self , config_name , options = None , env = None ):
8787 super (AbstractPythonVm , self ).__init__ ()
8888 self ._config_name = config_name
8989 self ._options = options
90+ self ._env = env
9091
9192 @property
9293 def options (self ):
@@ -125,15 +126,15 @@ def run(self, cwd, args):
125126 _check_vm_args (self .name (), args )
126127 out = mx .OutputCapture ()
127128 stdout_capture = mx .TeeOutputCapture (out )
128- ret_code = mx .run ([self .interpreter ] + args , out = stdout_capture , err = stdout_capture )
129+ ret_code = mx .run ([self .interpreter ] + args , out = stdout_capture , err = stdout_capture , env = self . _env )
129130 return ret_code , out .data
130131
131132
132133class AbstractPythonIterationsControlVm (AbstractPythonVm ):
133134 __metaclass__ = ABCMeta
134135
135- def __init__ (self , config_name , options = None , iterations = None ):
136- super (AbstractPythonIterationsControlVm , self ).__init__ (config_name , options )
136+ def __init__ (self , config_name , options = None , env = None , iterations = None ):
137+ super (AbstractPythonIterationsControlVm , self ).__init__ (config_name , options = options , env = env )
137138 try :
138139 self ._iterations = int (iterations )
139140 except :
@@ -160,8 +161,8 @@ def run(self, cwd, args):
160161class CPythonVm (AbstractPythonIterationsControlVm ):
161162 PYTHON_INTERPRETER = "python3"
162163
163- def __init__ (self , config_name , options = None , virtualenv = None , iterations = 0 ):
164- super (CPythonVm , self ).__init__ (config_name , options = options , iterations = iterations )
164+ def __init__ (self , config_name , options = None , env = None , virtualenv = None , iterations = 0 ):
165+ super (CPythonVm , self ).__init__ (config_name , options = options , env = env , iterations = iterations )
165166 self ._virtualenv = virtualenv
166167
167168 @property
@@ -177,8 +178,8 @@ def name(self):
177178class PyPyVm (AbstractPythonIterationsControlVm ):
178179 PYPY_INTERPRETER = "pypy3"
179180
180- def __init__ (self , config_name , options = None , iterations = None ):
181- super (PyPyVm , self ).__init__ (config_name , options = options , iterations = iterations )
181+ def __init__ (self , config_name , options = None , env = None , iterations = None ):
182+ super (PyPyVm , self ).__init__ (config_name , options = options , env = env , iterations = iterations )
182183
183184 @property
184185 def interpreter (self ):
0 commit comments