From 2b139158245db651b70ad6694b0aa3820e0e02d1 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 17 Dec 2022 19:29:37 -0600 Subject: [PATCH 1/3] try a skip --- tests/test_jupyter_server.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_jupyter_server.py b/tests/test_jupyter_server.py index 60542f1..618903f 100644 --- a/tests/test_jupyter_server.py +++ b/tests/test_jupyter_server.py @@ -2,6 +2,7 @@ import os from unittest.mock import MagicMock +import pytest from jupyter_server.auth import Authorizer from jupyter_server.serverapp import ServerApp from tornado.websocket import WebSocketHandler @@ -63,3 +64,7 @@ def test_template_dir(jp_template_dir): def test_extension_environ(jp_extension_environ): pass + + +def test_skip(jp_serverapp): + pytest.skip("Forcing a skip") From 9d32bf25180a0ed50a91748d077a826e870a697f Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 17 Dec 2022 19:30:31 -0600 Subject: [PATCH 2/3] try forcing a skip --- tests/test_jupyter_server.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_jupyter_server.py b/tests/test_jupyter_server.py index 618903f..dc48e6e 100644 --- a/tests/test_jupyter_server.py +++ b/tests/test_jupyter_server.py @@ -14,6 +14,10 @@ async def test_serverapp(jp_serverapp): assert isinstance(jp_serverapp, ServerApp) +def test_skip(jp_serverapp): + pytest.skip("Forcing a skip") + + async def test_get_api_spec(jp_fetch): response = await jp_fetch("api", "spec.yaml", method="GET") assert response.code == 200 @@ -64,7 +68,3 @@ def test_template_dir(jp_template_dir): def test_extension_environ(jp_extension_environ): pass - - -def test_skip(jp_serverapp): - pytest.skip("Forcing a skip") From d83c5b6464236ddd513e830aff59e93e0b4fb13c Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 17 Dec 2022 19:48:52 -0600 Subject: [PATCH 3/3] fix pypy and catch timeouterror --- .github/workflows/test.yml | 5 +++++ pytest_jupyter/jupyter_server.py | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 496ff75..f9cc628 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,7 +30,12 @@ jobs: steps: - uses: actions/checkout@v3 - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + - name: Run the tests on pypy + if: ${{ startsWith(matrix.python-version, 'pypy') }} + run: | + hatch run test:nowarn || hatch run test:nowarn --lf - name: Run the tests + if: ${{ !startsWith(matrix.python-version, 'pypy') }} run: hatch run cov:test || hatch run test:test --lf - name: Coverage run: | diff --git a/pytest_jupyter/jupyter_server.py b/pytest_jupyter/jupyter_server.py index 81156c6..f354661 100644 --- a/pytest_jupyter/jupyter_server.py +++ b/pytest_jupyter/jupyter_server.py @@ -67,7 +67,10 @@ async def get_server(): server.stop() if hasattr(server, "close_all_connections"): - io_loop.run_sync(server.close_all_connections) + try: + io_loop.run_sync(server.close_all_connections) + except TimeoutError: + pass http_server_port[0].close()