@@ -82,10 +82,11 @@ def _check_vm_args(name, args):
82
82
class AbstractPythonVm (Vm ):
83
83
__metaclass__ = ABCMeta
84
84
85
- def __init__ (self , config_name , options = None ):
85
+ def __init__ (self , config_name , options = None , env = None ):
86
86
super (AbstractPythonVm , self ).__init__ ()
87
87
self ._config_name = config_name
88
88
self ._options = options
89
+ self ._env = env
89
90
90
91
@property
91
92
def options (self ):
@@ -124,15 +125,15 @@ def run(self, cwd, args):
124
125
_check_vm_args (self .name (), args )
125
126
out = mx .OutputCapture ()
126
127
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 )
128
129
return ret_code , out .data
129
130
130
131
131
132
class AbstractPythonIterationsControlVm (AbstractPythonVm ):
132
133
__metaclass__ = ABCMeta
133
134
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 )
136
137
try :
137
138
self ._iterations = int (iterations )
138
139
except :
@@ -159,8 +160,8 @@ def run(self, cwd, args):
159
160
class CPythonVm (AbstractPythonIterationsControlVm ):
160
161
PYTHON_INTERPRETER = "python3"
161
162
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 )
164
165
self ._virtualenv = virtualenv
165
166
166
167
@property
@@ -176,8 +177,8 @@ def name(self):
176
177
class PyPyVm (AbstractPythonIterationsControlVm ):
177
178
PYPY_INTERPRETER = "pypy3"
178
179
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 )
181
182
182
183
@property
183
184
def interpreter (self ):
0 commit comments