-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathconftest.py
More file actions
57 lines (42 loc) · 1.39 KB
/
conftest.py
File metadata and controls
57 lines (42 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import pathlib
import sys
from typing import Any
import pytest
from graphql_server.utils import IS_GQL_32
def pytest_emoji_xfailed(config: pytest.Config) -> tuple[str, str]:
return "🤷♂️ ", "XFAIL 🤷♂️ "
def pytest_emoji_skipped(config: pytest.Config) -> tuple[str, str]:
return "🦘 ", "SKIPPED 🦘"
# @pytest.hookimpl # type: ignore
# def pytest_collection_modifyitems(config: pytest.Config, items: list[pytest.Item]):
# rootdir = pathlib.Path(config.rootdir) # type: ignore
# for item in items:
# rel_path = pathlib.Path(item.fspath).relative_to(rootdir)
# markers = [
# "aiohttp",
# "asgi",
# "chalice",
# "channels",
# "django",
# "fastapi",
# "flask",
# "quart",
# "pydantic",
# "sanic",
# "litestar",
# ]
# for marker in markers:
# if marker in rel_path.parts:
# item.add_marker(getattr(pytest.mark, marker))
@pytest.hookimpl
def pytest_ignore_collect(
collection_path: pathlib.Path, path: Any, config: pytest.Config
):
if sys.version_info < (3, 12) and "python_312" in collection_path.parts:
return True
return None
def skip_if_gql_32(reason: str) -> pytest.MarkDecorator:
return pytest.mark.skipif(
IS_GQL_32,
reason=reason,
)