Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle TimeoutError During Fixture Shutdown #40

Merged
merged 3 commits into from
Dec 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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