MCPcopy Create free account
hub / github.com/numpy/numpy / check_execute_in

Method check_execute_in

numpy/distutils/tests/test_exec_command.py:188–204  ·  view source on GitHub ↗
(self, **kws)

Source from the content-addressed store, hash-verified

186 assert_(o == 'Heipa')
187
188 def check_execute_in(self, **kws):
189 with tempdir() as tmpdir:
190 fn = "file"
191 tmpfile = os.path.join(tmpdir, fn)
192 with open(tmpfile, 'w') as f:
193 f.write('Hello')
194
195 s, o = exec_command.exec_command(
196 '"%s" -c "f = open(\'%s\', \'r\'); f.close()"' %
197 (self.pyexe, fn), **kws)
198 assert_(s != 0)
199 assert_(o != '')
200 s, o = exec_command.exec_command(
201 '"%s" -c "f = open(\'%s\', \'r\'); print(f.read()); '
202 'f.close()"' % (self.pyexe, fn), execute_in=tmpdir, **kws)
203 assert_(s == 0)
204 assert_(o == 'Hello')
205
206 def test_basic(self):
207 with redirect_stdout(StringIO()):

Callers 1

test_basicMethod · 0.95

Calls 5

tempdirFunction · 0.90
assert_Function · 0.90
openFunction · 0.85
joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected