Skip to content

Commit f9c8396

Browse files
committed
no driver tests on windows in CI right now
1 parent 81b2fbd commit f9c8396

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

tests/conftest.py

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
from __future__ import annotations
2+
3+
import os
14
import logging
25
import inspect
3-
from typing import Any, Iterator, Iterable
6+
from typing import Iterator, List
47

58
from loguru import logger
69
import pytest
@@ -17,11 +20,11 @@
1720
from idom.testing import ServerMountPoint, create_simple_selenium_web_driver
1821

1922

20-
def pytest_collection_modifyitems(items: Iterable[Any]) -> None:
21-
for item in items:
22-
if isinstance(item, pytest.Function):
23-
if inspect.iscoroutinefunction(item.function):
24-
item.add_marker(pytest.mark.asyncio)
23+
def pytest_collection_modifyitems(
24+
session: pytest.Session, config: pytest.config.Config, items: List[pytest.Item]
25+
) -> None:
26+
_mark_coros_as_async_tests(items)
27+
_xfail_driver_tests_on_windows(items)
2528

2629

2730
def pytest_addoption(parser: Parser) -> None:
@@ -135,3 +138,24 @@ def _restore_client(pytestconfig: Config) -> Iterator[None]:
135138
manage_client.restore()
136139
else:
137140
yield
141+
142+
143+
def _mark_coros_as_async_tests(items: List[pytest.Item]) -> None:
144+
for item in items:
145+
if isinstance(item, pytest.Function):
146+
if inspect.iscoroutinefunction(item.function):
147+
item.add_marker(pytest.mark.asyncio)
148+
149+
150+
def _xfail_driver_tests_on_windows(items: List[pytest.Item]) -> None:
151+
if os.name == "nt":
152+
for item in items:
153+
if isinstance(item, pytest.Function):
154+
if {"display", "driver", "create_driver"}.intersection(
155+
item.fixturenames
156+
):
157+
item.add_marker(
158+
pytest.mark.xfail(
159+
reason="WebDriver tests are not working on Windows",
160+
)
161+
)

0 commit comments

Comments
 (0)