diff --git a/phy/cluster/tests/test_supervisor.py b/phy/cluster/tests/test_supervisor.py index 8eeffb4e6..23881519b 100644 --- a/phy/cluster/tests/test_supervisor.py +++ b/phy/cluster/tests/test_supervisor.py @@ -8,7 +8,7 @@ #from contextlib import contextmanager -from pytest import yield_fixture, fixture +from pytest import fixture, fixture import numpy as np from numpy.testing import assert_array_equal as ae @@ -34,7 +34,7 @@ def handler(msg_type, msg_log_context, msg_string): # Fixtures #------------------------------------------------------------------------------ -@yield_fixture +@fixture def gui(tempdir, qtbot): # NOTE: mock patch show box exec_ _supervisor._show_box = lambda _: _ diff --git a/phy/cluster/views/tests/conftest.py b/phy/cluster/views/tests/conftest.py index a54b01c8a..4df26295e 100644 --- a/phy/cluster/views/tests/conftest.py +++ b/phy/cluster/views/tests/conftest.py @@ -6,7 +6,7 @@ # Imports #------------------------------------------------------------------------------ -from pytest import yield_fixture +from pytest import fixture from phy.gui import GUI @@ -15,7 +15,7 @@ # Utilities and fixtures #------------------------------------------------------------------------------ -@yield_fixture +@fixture def gui(tempdir, qtbot): gui = GUI(position=(200, 200), size=(800, 600), config_dir=tempdir) gui.set_default_actions() diff --git a/phy/gui/tests/conftest.py b/phy/gui/tests/conftest.py index ed8cfff17..f2d836bc4 100644 --- a/phy/gui/tests/conftest.py +++ b/phy/gui/tests/conftest.py @@ -6,7 +6,7 @@ # Imports #------------------------------------------------------------------------------ -from pytest import yield_fixture +from pytest import fixture from ..actions import Actions, Snippets from ..gui import GUI @@ -16,7 +16,7 @@ # Utilities and fixtures #------------------------------------------------------------------------------ -@yield_fixture +@fixture def gui(tempdir, qtbot): gui = GUI(position=(200, 100), size=(100, 100), config_dir=tempdir) gui.set_default_actions() @@ -28,11 +28,11 @@ def gui(tempdir, qtbot): del gui -@yield_fixture +@fixture def actions(gui): yield Actions(gui, name='actions') -@yield_fixture +@fixture def snippets(gui): yield Snippets(gui) diff --git a/phy/gui/tests/test_widgets.py b/phy/gui/tests/test_widgets.py index df2207058..4ce0eae3f 100644 --- a/phy/gui/tests/test_widgets.py +++ b/phy/gui/tests/test_widgets.py @@ -8,7 +8,7 @@ from functools import partial from pathlib import Path -from pytest import yield_fixture, mark +from pytest import fixture, mark from phylib.utils import connect, unconnect from phylib.utils.testing import captured_logging @@ -37,7 +37,7 @@ def _wait_until_table_ready(qtbot, table): b.wait() -@yield_fixture +@fixture def table(qtbot): columns = ["id", "count"] data = [{"id": i, diff --git a/phy/plot/tests/conftest.py b/phy/plot/tests/conftest.py index d62862781..d60ecacf2 100644 --- a/phy/plot/tests/conftest.py +++ b/phy/plot/tests/conftest.py @@ -6,7 +6,7 @@ # Imports #------------------------------------------------------------------------------ -from pytest import fixture, yield_fixture +from pytest import fixture, fixture from ..base import BaseCanvas from ..panzoom import PanZoom @@ -16,7 +16,7 @@ # Utilities and fixtures #------------------------------------------------------------------------------ -@yield_fixture +@fixture def canvas(qapp, qtbot): c = BaseCanvas() yield c diff --git a/phy/plot/tests/test_base.py b/phy/plot/tests/test_base.py index 7ac8bf58d..5382aa38b 100644 --- a/phy/plot/tests/test_base.py +++ b/phy/plot/tests/test_base.py @@ -10,7 +10,7 @@ import logging import numpy as np -from pytest import yield_fixture +from pytest import fixture from ..base import BaseVisual, GLSLInserter, gloo from ..transform import (subplot_bounds, Translate, Scale, Range, @@ -25,7 +25,7 @@ # Fixtures #------------------------------------------------------------------------------ -@yield_fixture +@fixture def vertex_shader_nohook(): yield """ attribute vec2 a_position; @@ -35,7 +35,7 @@ def vertex_shader_nohook(): """ -@yield_fixture +@fixture def vertex_shader(): yield """ attribute vec2 a_position; @@ -46,7 +46,7 @@ def vertex_shader(): """ -@yield_fixture +@fixture def fragment_shader(): yield """ void main() { diff --git a/phy/plot/tests/test_panzoom.py b/phy/plot/tests/test_panzoom.py index 620881248..56c909c0b 100644 --- a/phy/plot/tests/test_panzoom.py +++ b/phy/plot/tests/test_panzoom.py @@ -10,7 +10,7 @@ import os from numpy.testing import assert_allclose as ac -from pytest import yield_fixture +from pytest import fixture from . import mouse_drag, key_press from ..base import BaseVisual @@ -34,7 +34,7 @@ def set_data(self): self.emit_visual_set_data() -@yield_fixture +@fixture def panzoom(qtbot, canvas_pz): c = canvas_pz visual = MyTestVisual() diff --git a/phy/utils/tests/conftest.py b/phy/utils/tests/conftest.py index 25f21eac2..27d6ee4c1 100644 --- a/phy/utils/tests/conftest.py +++ b/phy/utils/tests/conftest.py @@ -6,14 +6,14 @@ # Imports #------------------------------------------------------------------------------ -from pytest import yield_fixture +from pytest import fixture #------------------------------------------------------------------------------ # Common fixtures #------------------------------------------------------------------------------ -@yield_fixture +@fixture def temp_config_dir(tempdir): """NOTE: the user directory should be loaded with: diff --git a/phy/utils/tests/test_context.py b/phy/utils/tests/test_context.py index 968a15a5e..44c554459 100644 --- a/phy/utils/tests/test_context.py +++ b/phy/utils/tests/test_context.py @@ -10,7 +10,7 @@ import numpy as np from numpy.testing import assert_array_equal as ae -from pytest import fixture, yield_fixture +from pytest import fixture, fixture from phylib.io.array import write_array, read_array from ..context import Context, _fullname @@ -26,7 +26,7 @@ def context(tempdir): return ctx -@yield_fixture +@fixture def temp_phy_config_dir(tempdir): """Use a temporary phy user directory.""" import phy.utils.context diff --git a/phy/utils/tests/test_plugin.py b/phy/utils/tests/test_plugin.py index 68f128d31..7b5ee4e30 100644 --- a/phy/utils/tests/test_plugin.py +++ b/phy/utils/tests/test_plugin.py @@ -9,7 +9,7 @@ from textwrap import dedent -from pytest import yield_fixture, raises +from pytest import fixture, raises from ..plugin import (IPluginRegistry, IPlugin, @@ -24,7 +24,7 @@ # Fixtures #------------------------------------------------------------------------------ -@yield_fixture +@fixture def no_native_plugins(): # Save the plugins. plugins = IPluginRegistry.plugins