From 920d49593c36e1745770194c0be8bc25ddb79597 Mon Sep 17 00:00:00 2001 From: MinRK Date: Wed, 15 Oct 2014 17:38:59 -0700 Subject: [PATCH] refuse to run js tests with phantom + tornado 4 websocket connections fail with 426 because phantomjs implements a super old draft of webosockets that recent tornado doesn't support This refused to run in that situation with an informative message. --- IPython/testing/iptestcontroller.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/IPython/testing/iptestcontroller.py b/IPython/testing/iptestcontroller.py index 3a047132e..87277cd6a 100644 --- a/IPython/testing/iptestcontroller.py +++ b/IPython/testing/iptestcontroller.py @@ -22,7 +22,10 @@ import subprocess import time import re -from .iptest import have, test_group_names as py_test_group_names, test_sections, StreamCapturer +from .iptest import ( + have, test_group_names as py_test_group_names, test_sections, StreamCapturer, + test_for, +) from IPython.utils.path import compress_user from IPython.utils.py3compat import bytes_to_str from IPython.utils.sysinfo import get_sys_info @@ -288,7 +291,12 @@ class JSController(TestController): @property def will_run(self): - return all(have[a] for a in self.requirements + [self.engine]) + should_run = all(have[a] for a in self.requirements + [self.engine]) + tornado4 = test_for('tornado.version_info', (4,0,0), callback=None) + if should_run and self.engine == 'phantomjs' and tornado4: + print("phantomjs cannot connect websockets to tornado 4", file=sys.stderr) + return False + return should_run def _init_server(self): "Start the notebook server in a separate process"