Skip to content

Commit

Permalink
Create a unique & temporary IPYTHONDIR for each testing group.
Browse files Browse the repository at this point in the history
  • Loading branch information
bfroehle committed Jul 26, 2012
1 parent b2fc42b commit 0b4fd4c
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions IPython/testing/iptest.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
from IPython.utils.path import get_ipython_module_path, get_ipython_package_dir
from IPython.utils.process import find_cmd, pycmd2argv
from IPython.utils.sysinfo import sys_info
from IPython.utils.tempdir import TemporaryDirectory
from IPython.utils.warn import warn

from IPython.testing import globalipapp
Expand Down Expand Up @@ -374,15 +375,18 @@ def __init__(self, runner='iptest', params=None):
self.processes = []

def _run_cmd(self):
# print >> sys.stderr, '*** CMD:', ' '.join(self.call_args) # dbg
subp = subprocess.Popen(self.call_args)
self.processes.append(subp)
# If this fails, the process will be left in self.processes and cleaned
# up later, but if the wait call succeeds, then we can clear the
# stored process.
retcode = subp.wait()
self.processes.pop()
return retcode
with TemporaryDirectory() as IPYTHONDIR:
env = os.environ.copy()
env['IPYTHONDIR'] = IPYTHONDIR
# print >> sys.stderr, '*** CMD:', ' '.join(self.call_args) # dbg
subp = subprocess.Popen(self.call_args, env=env)
self.processes.append(subp)
# If this fails, the process will be left in self.processes and
# cleaned up later, but if the wait call succeeds, then we can
# clear the stored process.
retcode = subp.wait()
self.processes.pop()
return retcode

def run(self):
"""Run the stored commands"""
Expand Down

0 comments on commit 0b4fd4c

Please sign in to comment.