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