From 8fc98a6a0be80a69a5f7aeb5f9f77019ccae255a Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Wed, 14 Dec 2016 10:07:16 -0800 Subject: [PATCH 1/3] Add print wrapper to work around interrupted system calls on travis --- examples/test_examples.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/examples/test_examples.py b/examples/test_examples.py index 3e6b8200..65e6f9bb 100644 --- a/examples/test_examples.py +++ b/examples/test_examples.py @@ -3,6 +3,30 @@ from pyqtgraph import Qt from . import utils import itertools import pytest +import os +import __builtin__ + + +# 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: + 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 = __builtin__.print + __builtin__.print = flaky_print + print("Installed wrapper for flaky print.") + # apparently importlib does not exist in python 2.6... try: From 8d85b87d71f28c539ba971f07d92a39fc6ed70bc Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Wed, 14 Dec 2016 10:14:11 -0800 Subject: [PATCH 2/3] py3 fix --- examples/test_examples.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/test_examples.py b/examples/test_examples.py index 65e6f9bb..9b3f8eb7 100644 --- a/examples/test_examples.py +++ b/examples/test_examples.py @@ -3,13 +3,17 @@ from pyqtgraph import Qt from . import utils import itertools import pytest -import os -import __builtin__ +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. """ @@ -24,7 +28,7 @@ if os.getenv('TRAVIS') is not None: raise pass orig_print = __builtin__.print - __builtin__.print = flaky_print + builtins.print = flaky_print print("Installed wrapper for flaky print.") From 24b288a05aadd33305b1c86b2b829de03f9937ab Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Wed, 14 Dec 2016 10:19:01 -0800 Subject: [PATCH 3/3] really actually fix --- examples/test_examples.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/test_examples.py b/examples/test_examples.py index 9b3f8eb7..ae88b087 100644 --- a/examples/test_examples.py +++ b/examples/test_examples.py @@ -27,7 +27,7 @@ if os.getenv('TRAVIS') is not None: if count >= 5: raise pass - orig_print = __builtin__.print + orig_print = builtins.print builtins.print = flaky_print print("Installed wrapper for flaky print.")