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

upgrade pytest #4171

Merged
merged 2 commits into from
Sep 12, 2024
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
63 changes: 32 additions & 31 deletions poetry.lock

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

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ protobuf = "*"
nanopb = "^0.4.3"

## test tools
pytest = "^6.1.0"
pytest = "^8"
coverage = "<5" # coverage 5+ uses binary sqlite format
flaky = "^3.6.1" # https://github.com/box/flaky/issues/156
flaky = ">3.6.1" # https://github.com/box/flaky/issues/156
pytest-ordering = "*"
pytest-random-order = "*"
pytest-timeout = "*"
Expand Down
11 changes: 11 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@

import os
import typing as t
from enum import IntEnum
from pathlib import Path

import pytest
import xdist
from _pytest.python import IdMaker
from _pytest.reports import TestReport

from trezorlib import debuglink, log, models
Expand Down Expand Up @@ -464,6 +466,15 @@ def pytest_configure(config: "Config") -> None:
if config.getoption("verbose"):
log.enable_debug_output()

idval_orig = IdMaker._idval_from_value

def idval_from_value(self: IdMaker, val: object) -> str | None:
if isinstance(val, IntEnum):
return f"{type(val).__name__}.{val.name}"
return idval_orig(self, val)

IdMaker._idval_from_value = idval_from_value


def pytest_runtest_setup(item: pytest.Item) -> None:
"""Called for each test item (class, individual tests).
Expand Down
Loading
Loading