Skip to content

chore: Update test dependencies in Python projects #18581

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

Open
wants to merge 18 commits into
base: edge
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
9874f8d
shared-data: Upgrade and loosen pytest.
SyntaxColoring Jun 10, 2025
b9d0771
system-server: Upgrade and loosen various deps.
SyntaxColoring Jun 10, 2025
92a2430
api: Upgrade and loosen various deps.
SyntaxColoring Jun 10, 2025
1fddc84
api: Delete Decoy warning workaround.
SyntaxColoring Jun 10, 2025
5174451
api: Replace pytest-lazy-fixture with pytest-lazy-fixtures.
SyntaxColoring Jun 10, 2025
c1d939f
api: Fix lazy-fixture session scope.
SyntaxColoring Jun 10, 2025
7f37d06
api: Delete ignored Pytest marks to resolve warnings.
SyntaxColoring Jun 10, 2025
f94d903
usb-bridge: Upgrade and loosen various deps.
SyntaxColoring Jun 10, 2025
ab077ba
robot-server: Upgrade and loosen various deps.
SyntaxColoring Jun 10, 2025
e25d9ef
update-server: Upgrade pytest and decoy.
SyntaxColoring Jun 10, 2025
e6927cb
update-server: Get `async def` tests running again.
SyntaxColoring Jun 10, 2025
2f8544c
server-utils: upgrade decoy, pytest, pytest-asyncio; uninstall pytest…
SyntaxColoring Jun 10, 2025
6fa4875
server-utils: Uninstall python-box.
SyntaxColoring Jun 10, 2025
dfee044
g-code-testing: upgrade pytest, pytest-asyncio; uninstall decoy.
SyntaxColoring Jun 10, 2025
1b3bc70
test-data-generation: upgrade pytest, pytest-asyncio, hypothesis
SyntaxColoring Jun 10, 2025
5772b0c
performance-metrics: upgrade pytest, pytest-asyncio
SyntaxColoring Jun 10, 2025
62dbb9b
hardware: upgrade pytest, pytest-asyncio, pytest-lazy-fixture, hypoth…
SyntaxColoring Jun 10, 2025
d5338b1
hardware: Fix ignored pytest mark.
SyntaxColoring Jun 10, 2025
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
10 changes: 5 additions & 5 deletions api/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ colorama = { version = "==0.4.4", markers="sys_platform=='win32'" }
coverage = "==7.4.1"
mypy = "==1.11.0"
numpydoc = "==0.9.1"
pytest = "==7.4.4"
pytest-asyncio = "~=0.23.0"
pytest = "<9,>=8"
pytest-asyncio = "<2,>=0.23.0"
pytest-cov = "==4.1.0"
pytest-lazy-fixture = "==0.6.3"
pytest-xdist = "~=2.5.0"
sphinx = "==5.0.1"
twine = "==4.0.0"
Expand All @@ -45,7 +44,7 @@ flake8 = "==7.0.0"
flake8-annotations = "~=3.0.1"
flake8-docstrings = "~=1.7.0"
flake8-noqa = "~=1.4.0"
decoy = "==2.1.1"
decoy = "<3,>=2.2.0"
black = "==22.3.0"
types-mock = "~=5.1.0"
types-setuptools = "==57.0.2"
Expand All @@ -54,5 +53,6 @@ typing-extensions = ">=4.0.0,<5"
pytest-profiling = "~=1.7.0"
# TODO(mc, 2022-03-31): upgrade sphinx, remove this subdep pin
jinja2 = ">=2.3,<3.1"
hypothesis = "==6.96.1"
hypothesis = "<7,>=6.96.1"
build = "~=1.2.0"
pytest-lazy-fixtures = "<2,>=1.1.4"
133 changes: 67 additions & 66 deletions api/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions api/pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ addopts = --color=yes --strict-markers
asyncio_mode = auto

filterwarnings =
# TODO this should be looked into being removed upon updating the Decoy library. The purpose of this warning is to
# catch missing attributes, but it raises for any property referenced in a test which accounts for about ~250 warnings
# which aren't serving any useful purpose and obscure other warnings.
ignore::decoy.warnings.MissingSpecAttributeWarning
# Pydantic's shims for its legacy v1 methods (e.g. `BaseModel.construct()`)
# are not type-checked properly. Forbid them, so we're forced to use their newer
# v2 replacements which are type-checked (e.g. ``BaseModel.model_construct()`)
Expand Down
2 changes: 1 addition & 1 deletion api/tests/opentrons/config/test_advanced_settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from pytest_lazyfixture import lazy_fixture # type: ignore[import-untyped]
from pytest_lazy_fixtures import lf as lazy_fixture
from typing import Dict, Generator, Optional
from unittest.mock import MagicMock, patch

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest
from _pytest.fixtures import SubRequest
from pytest_lazyfixture import lazy_fixture # type: ignore[import-untyped]
from pytest_lazy_fixtures import lf as lazy_fixture
from opentrons.config.advanced_settings import _migrate, _ensure


Expand Down Expand Up @@ -439,7 +439,6 @@ def v37_config(v36_config: Dict[str, Any]) -> Dict[str, Any]:


@pytest.fixture(
scope="session",
params=[
lazy_fixture("empty_settings"),
lazy_fixture("version_less"),
Expand Down
14 changes: 0 additions & 14 deletions api/tests/opentrons/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
)

from opentrons import config
from opentrons import hardware_control as hc
from opentrons.drivers.rpi_drivers.gpio_simulator import SimulatingGPIOCharDev
from opentrons.hardware_control import (
API,
Expand Down Expand Up @@ -426,19 +425,6 @@ def hardware_controller_lockfile(
return lockfile_dir


@pytest.mark.skipif(
not hc.Controller,
reason="hardware controller not available (probably windows)",
)
@pytest.fixture()
def cntrlr_mock_connect(monkeypatch: pytest.MonkeyPatch) -> None:
async def mock_connect(obj: object, port: Any = None) -> None:
return

monkeypatch.setattr(hc.Controller, "connect", mock_connect)
monkeypatch.setattr(hc.Controller, "fw_version", "virtual")


@pytest.fixture()
async def hardware_api(is_robot: None) -> HardwareControlAPI:
hw_api = await API.build_hardware_simulator(loop=asyncio.get_running_loop())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@
)


@pytest.mark.ot3_only
@pytest.fixture
def initial_state() -> "EstopSummary":
return EstopSummary(left_detected=True, right_detected=True, engaged=False)


@pytest.mark.ot3_only
@pytest.fixture
def mock_estop_detector(decoy: Decoy, initial_state: "EstopSummary") -> "EstopDetector":
"""Create a mocked estop detector."""
Expand All @@ -31,7 +29,6 @@ def mock_estop_detector(decoy: Decoy, initial_state: "EstopSummary") -> "EstopDe
return mock


@pytest.mark.ot3_only
@pytest.fixture
def subject(mock_estop_detector: "EstopDetector") -> "EstopStateMachine":
return EstopStateMachine(detector=mock_estop_detector)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Union, cast

import pytest
from pytest_lazyfixture import lazy_fixture # type: ignore[import-untyped]
from pytest_lazy_fixtures import lf as lazy_fixture
from decoy import Decoy

from opentrons_shared_data.labware.types import (
Expand Down
1 change: 0 additions & 1 deletion api/tests/opentrons/hardware_control/test_gripper.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
fake_gripper_conf = gripper_config.load(GripperModel.v1)


@pytest.mark.ot3_only
@pytest.fixture
def fake_offset() -> "GripperCalibrationOffset":
from opentrons.hardware_control.instruments.ot3.instrument_calibration import (
Expand Down
2 changes: 1 addition & 1 deletion api/tests/opentrons/hardware_control/test_pipette.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from opentrons_shared_data.errors.exceptions import InvalidLiquidClassName
from opentrons.calibration_storage import types as cal_types
from opentrons.types import Point, Mount
from pytest_lazyfixture import lazy_fixture # type: ignore[import-untyped]
from pytest_lazy_fixtures import lf as lazy_fixture
from opentrons.hardware_control.instruments.ot2 import (
pipette as ot2_pipette,
instrument_calibration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import mock

from typing import ContextManager, Any, Optional
from pytest_lazyfixture import lazy_fixture # type: ignore[import-untyped]
from pytest_lazy_fixtures import lf as lazy_fixture
from contextlib import nullcontext as does_not_raise
from opentrons.types import Location, Point

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from unittest.mock import sentinel

from decoy import Decoy, matchers
from pytest_lazyfixture import lazy_fixture # type: ignore[import-untyped]
from pytest_lazy_fixtures import lf as lazy_fixture

from opentrons.protocol_engine.commands.pipetting_common import LiquidNotFoundError
from opentrons.protocol_engine.errors.error_occurrence import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import pytest
from _pytest.fixtures import SubRequest
from pytest_lazyfixture import lazy_fixture # type: ignore[import-untyped]
from pytest_lazy_fixtures import lf as lazy_fixture

from opentrons.protocol_api.core.common import InstrumentCore, LabwareCore
from opentrons.types import Location, Point
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import cast
import pytest
from _pytest.fixtures import SubRequest
from pytest_lazyfixture import lazy_fixture # type: ignore[import-untyped]
from pytest_lazy_fixtures import lf as lazy_fixture

from opentrons_shared_data.pipette.types import PipetteNameType

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
from opentrons.hardware_control.ot3api import OT3API


@pytest.mark.ot3_only
@pytest.fixture(autouse=True)
def _mock_ot3_calibration(decoy: Decoy, monkeypatch: pytest.MonkeyPatch) -> None:
for name, func in inspect.getmembers(ot3_calibration, inspect.isfunction):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
from opentrons.hardware_control.ot3api import OT3API


@pytest.mark.ot3_only
@pytest.fixture(autouse=True)
def _mock_ot3_calibration(decoy: Decoy, monkeypatch: pytest.MonkeyPatch) -> None:
for name, func in inspect.getmembers(calibration, inspect.isfunction):
Expand Down
Loading
Loading