Merge pull request #416 from campagnola/fix-travis-ioerror

Add print wrapper to work around interrupted system calls on travis
This commit is contained in:
Luke Campagnola 2016-12-14 10:35:24 -08:00 committed by GitHub
commit 870a61d2ae

View File

@ -3,6 +3,34 @@ from pyqtgraph import Qt
from . import utils
import itertools
import pytest
import os, sys
# printing on travis ci frequently leads to "interrupted system call" errors.
# as a workaround, we overwrite the built-in print function (bleh)
if os.getenv('TRAVIS') is not None:
if sys.version_info[0] < 3:
import __builtin__ as builtins
else:
import builtins
def flaky_print(*args):
"""Wrapper for print that retries in case of IOError.
"""
count = 0
while count < 5:
count += 1
try:
orig_print(*args)
break
except IOError:
if count >= 5:
raise
pass
orig_print = builtins.print
builtins.print = flaky_print
print("Installed wrapper for flaky print.")
# apparently importlib does not exist in python 2.6...
try: