Merge pull request #2202 from bfroehle/iptest_IPYTHONDIR

Create a unique & temporary IPYTHONDIR for each testing group.

Following #2148 (unification of Windows / Unix code in iptest), and
in progress towards #1880 (Add parallelism to iptest & test_pr), this
pull request launches each iptest test group with a unique & temporary
`IPYTHONDIR`.

This has two benefits:
* Insulates the test suite from any craziness in your own configuration.
  (Try adding `import sys; sys.exit()` to your config file...).
* Allows multiple test suites to be launched in parallel without the worry of
  conflicts.
Fernando Perez 14 years ago
commit 3e180cb217

@ -59,6 +59,7 @@ from IPython.utils.importstring import import_item
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
@ -374,15 +375,18 @@ class IPTester(object):
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"""

Loading…
Cancel
Save