Commit 4abf42d0 authored by Michael Droettboom's avatar Michael Droettboom Committed by GitHub

Merge pull request #210 from rth/fix-selenium

Hotfix selenium ConnectionError issue
parents 222457c2 df212318
......@@ -7,7 +7,7 @@ import sys
sys.path.insert(
0, str((Path(__file__).resolve().parents[1] / 'test')))
import conftest # noqa
import conftest # noqa: E402
SKIP = set(['fft', 'hyantes', 'README'])
......
import socket
# Temporary fix from https://github.com/SeleniumHQ/selenium/pull/6480
# to avoid ConnectionError in selenium
def _selenium_is_connectable(port, host="localhost"):
"""
Tries to connect to the server at port to see if it is running.
:Args:
- port - The port to connect.
"""
socket_ = None
try:
socket_ = socket.create_connection((host, port), 1)
result = True
except (socket.error, ConnectionError):
result = False
finally:
if socket_:
socket_.close()
return result
......@@ -16,6 +16,15 @@ import shutil
TEST_PATH = pathlib.Path(__file__).parents[0].resolve()
BUILD_PATH = TEST_PATH / '..' / 'build'
sys.path.append(TEST_PATH / '..')
from pyodide_build._fixes import _selenium_is_connectable # noqa: E402
import selenium.webdriver.common.utils # noqa: E402
# XXX: Temporary fix for ConnectionError in selenium
selenium.webdriver.common.utils.is_connectable = _selenium_is_connectable
try:
import pytest
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment