Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

parallel tests & extra readline escapes #666

Merged
merged 2 commits into from

2 participants

@minrk
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.

minrk added some commits
@minrk minrk improve reliability of occasionally failing parallel tests 2c49a0d
@minrk minrk 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
@fperez fperez merged commit 6d90a9e into from
@fperez fperez referenced this pull request from a commit
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
Commits on Aug 2, 2011
  1. @minrk
  2. @minrk

    strip leading 'ESC[?1034h' in tests caused by `import readline`

    minrk authored
    `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
This page is out of date. Refresh to see the latest.
View
2  IPython/parallel/tests/test_client.py
@@ -228,6 +228,8 @@ def f():
v = self.client.load_balanced_view()
ar = v.apply_async(f)
r1 = ar.get(1)
+ # give the Hub a chance to notice:
+ time.sleep(0.5)
ahr = self.client.resubmit(ar.msg_ids)
r2 = ahr.get(1)
self.assertFalse(r1 == r2)
View
1  IPython/parallel/tests/test_lbview.py
@@ -59,6 +59,7 @@ def f(x):
def test_abort(self):
view = self.view
ar = self.client[:].apply_async(time.sleep, .5)
+ ar = self.client[:].apply_async(time.sleep, .5)
ar2 = view.apply_async(lambda : 2)
ar3 = view.apply_async(lambda : 3)
view.abort(ar2)
View
2  IPython/parallel/tests/test_view.py
@@ -319,7 +319,7 @@ def test_magic_px_blocking(self):
ip.magic_px('print a')
sys.stdout = savestdout
buf = sio.getvalue()
- self.assertTrue('[stdout:%i]'%v.targets in buf)
+ self.assertTrue('[stdout:' in buf, buf)
self.assertTrue(buf.rstrip().endswith('10'))
self.assertRaisesRemote(ZeroDivisionError, ip.magic_px, '1/0')
View
13 IPython/testing/tools.py
@@ -213,7 +213,18 @@ def ipexec(fname, options=None):
full_fname = os.path.join(test_dir, fname)
full_cmd = '%s %s %s' % (ipython_cmd, cmdargs, full_fname)
#print >> sys.stderr, 'FULL CMD:', full_cmd # dbg
- return getoutputerror(full_cmd)
+ out = getoutputerror(full_cmd)
+ # `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
+ if out:
+ first = out[0]
+ m = re.match(r'\x1b\[[^h]+h', first)
+ if m:
+ # strip initial readline escape
+ out = list(out)
+ out[0] = first[len(m.group()):]
+ out = tuple(out)
+ return out
def ipexec_validate(fname, expected_out, expected_err='',
Something went wrong with that request. Please try again.