Skip to content

Commit

Permalink
Fix tests when run on pytest 7.2, related to mark inheritance: pytest…
Browse files Browse the repository at this point in the history
  • Loading branch information
rytilahti committed Jan 6, 2023
1 parent bc31444 commit 67d9d77
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions miio/integrations/airpurifier/zhimi/tests/test_airfresh.py
Expand Up @@ -58,6 +58,11 @@ def __init__(self, *args, **kwargs):

@pytest.fixture(scope="class")
def airfresh(request):
# pytest 7.2.0 changed the handling of marks, see https://github.com/pytest-dev/pytest/issues/7792
# the result is subclass device attribute to be overridden for TestAirFreshVA4,
# this hack checks if we already have a device to avoid doing that
if getattr(request.cls, "device", None) is not None:
return
request.cls.device = DummyAirFresh()
# TODO add ability to test on a real device

Expand Down

0 comments on commit 67d9d77

Please sign in to comment.