Skip to content

Commit

Permalink
Handle TimeoutError During Fixture Shutdown (#40)
Browse files Browse the repository at this point in the history
Fixes #39
  • Loading branch information
blink1073 authored Dec 18, 2022
1 parent d6216bd commit 5e9a4dd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
5 changes: 4 additions & 1 deletion pytest_jupyter/jupyter_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
5 changes: 5 additions & 0 deletions tests/test_jupyter_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -13,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
Expand Down

0 comments on commit 5e9a4dd

Please sign in to comment.