Skip to content
This repository

parallel tests & extra readline escapes #666

Merged
merged 2 commits into from over 2 years ago

2 participants

Min RK Fernando Perez
Min RK
Owner

See #662

This adds some extra waits, etc. to a few parallel tests, to make them less likely to fail, which they have done on rare occasion. It's difficult to be conclusive, given the multiprocessing/network nature of the tests.

It has also been revealed that when building python-readline for OSX 10.7 python-2.7, import readline prints the escape 'ESC[?1034h' to stdout (not sys.stdout, because it doesn't appear to be redirected, the hardwired process stdout). Since I've seen reference to this behavior of readline even outside Python (http://www.google.com/search?q=readline+1034h), I added handling to ignore it in the test suite, so IPython.core.tests.test_run once again passes all tests on system Python on OSX 10.7.

added some commits August 02, 2011
Min RK improve reliability of occasionally failing parallel tests 2c49a0d
Min RK strip leading 'ESC[?1034h' in tests caused by `import readline`
`import readline` causes 'ESC[?1034h' to be the first output sometimes,
so strip that off the front of the first line if it is found.

This has been reported to RedHat in 2007, but appears to only apply to
OSX 10.7 at the moment.

closes gh-662
8ef2842
Fernando Perez fperez merged commit 6d90a9e into from August 15, 2011
Fernando Perez fperez closed this August 15, 2011
Fernando Perez fperez referenced this pull request from a commit January 10, 2012
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Aug 02, 2011
Min RK improve reliability of occasionally failing parallel tests 2c49a0d
Min RK strip leading 'ESC[?1034h' in tests caused by `import readline`
`import readline` causes 'ESC[?1034h' to be the first output sometimes,
so strip that off the front of the first line if it is found.

This has been reported to RedHat in 2007, but appears to only apply to
OSX 10.7 at the moment.

closes gh-662
8ef2842
This page is out of date. Refresh to see the latest.
2  IPython/parallel/tests/test_client.py
@@ -228,6 +228,8 @@ def f():
228 228
         v = self.client.load_balanced_view()
229 229
         ar = v.apply_async(f)
230 230
         r1 = ar.get(1)
  231
+        # give the Hub a chance to notice:
  232
+        time.sleep(0.5)
231 233
         ahr = self.client.resubmit(ar.msg_ids)
232 234
         r2 = ahr.get(1)
233 235
         self.assertFalse(r1 == r2)
1  IPython/parallel/tests/test_lbview.py
@@ -59,6 +59,7 @@ def f(x):
59 59
     def test_abort(self):
60 60
         view = self.view
61 61
         ar = self.client[:].apply_async(time.sleep, .5)
  62
+        ar = self.client[:].apply_async(time.sleep, .5)
62 63
         ar2 = view.apply_async(lambda : 2)
63 64
         ar3 = view.apply_async(lambda : 3)
64 65
         view.abort(ar2)
2  IPython/parallel/tests/test_view.py
@@ -319,7 +319,7 @@ def test_magic_px_blocking(self):
319 319
         ip.magic_px('print a')
320 320
         sys.stdout = savestdout
321 321
         buf = sio.getvalue()
322  
-        self.assertTrue('[stdout:%i]'%v.targets in buf)
  322
+        self.assertTrue('[stdout:' in buf, buf)
323 323
         self.assertTrue(buf.rstrip().endswith('10'))
324 324
         self.assertRaisesRemote(ZeroDivisionError, ip.magic_px, '1/0')
325 325
 
13  IPython/testing/tools.py
@@ -213,7 +213,18 @@ def ipexec(fname, options=None):
213 213
     full_fname = os.path.join(test_dir, fname)
214 214
     full_cmd = '%s %s %s' % (ipython_cmd, cmdargs, full_fname)
215 215
     #print >> sys.stderr, 'FULL CMD:', full_cmd # dbg
216  
-    return getoutputerror(full_cmd)
  216
+    out = getoutputerror(full_cmd)
  217
+    # `import readline` causes 'ESC[?1034h' to be the first output sometimes,
  218
+    # so strip that off the front of the first line if it is found
  219
+    if out:
  220
+        first = out[0]
  221
+        m = re.match(r'\x1b\[[^h]+h', first)
  222
+        if m:
  223
+            # strip initial readline escape
  224
+            out = list(out)
  225
+            out[0] = first[len(m.group()):]
  226
+            out = tuple(out)
  227
+    return out
217 228
 
218 229
 
219 230
 def ipexec_validate(fname, expected_out, expected_err='',
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.