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

Add compat with pytest 8 #1231

Merged
merged 2 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Add compat with pytest 8
  • Loading branch information
blink1073 committed Apr 8, 2024
commit 53b63239a543cc9c631db9f63612d80d4182e498
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ docs = [
"trio"
]
test = [
"pytest>=7.0,<8",
"pytest>=7.0,<9",
"pytest-cov",
"flaky",
"ipyparallel",
Expand Down
9 changes: 5 additions & 4 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import tempfile
from unittest.mock import patch

import pytest

from ipykernel.kernelspec import install

pjoin = os.path.join
Expand All @@ -15,7 +17,8 @@
patchers: list = []


def setup():
@pytest.fixture(autouse=True)
def _global_setup():
"""setup temporary env for tests"""
global tmp
tmp = tempfile.mkdtemp()
Expand All @@ -34,9 +37,7 @@ def setup():

# install IPython in the temp home:
install(user=True)


def teardown():
yield
for p in patchers:
p.stop()

Expand Down
7 changes: 3 additions & 4 deletions tests/test_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@
KC = KM = None


def setup_function():
@pytest.fixture(autouse=True)
def _setup_env():
"""start the global kernel (if it isn't running) and return its client"""
global KM, KC
KM, KC = start_new_kernel()
flush_channels(KC)


def teardown_function():
yield
assert KC is not None
assert KM is not None
KC.stop_channels()
Expand Down
7 changes: 3 additions & 4 deletions tests/test_eventloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,13 @@ def _get_qt_vers():
_get_qt_vers()


def setup():
@pytest.fixture(autouse=True)
def _setup_env():
"""start the global kernel (if it isn't running) and return its client"""
global KM, KC
KM, KC = start_new_kernel()
flush_channels(KC)


def teardown():
yield
assert KM is not None
assert KC is not None
KC.stop_channels()
Expand Down
Loading