From 3fc8fdb3b6d5ec70a94a83b7b0d7cb85f1019b7d 2012-06-24 00:55:07
From: Jonathan March <jmarch@enthought.com>
Date: 2012-06-24 00:55:07
Subject: [PATCH] BUG: test runner fails in Windows if filenames contain spaces.

---

diff --git a/IPython/testing/iptest.py b/IPython/testing/iptest.py
index fd853d3..221a3c8 100644
--- a/IPython/testing/iptest.py
+++ b/IPython/testing/iptest.py
@@ -372,6 +372,10 @@ class IPTester(object):
             # reliably in win32.
             # What types of problems are you having. They may be related to
             # running Python in unboffered mode. BG.
+            for ndx, arg in enumerate(self.call_args):
+                # Enclose in quotes if necessary and legal
+                if ' ' in arg and os.path.isfile(arg) and arg[0] != '"':
+                    self.call_args[ndx] = '"%s"' % arg
             return os.system(' '.join(self.call_args))
     else:
         def _run_cmd(self):