Skip to content

Commit a1fa908

Browse files
committed
Make test_web_app more pytest-xdist friendly
1 parent 7dd63e7 commit a1fa908

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

tests/test_web_app.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,34 @@ def test_appkey() -> None:
113113

114114
def test_appkey_repr_concrete() -> None:
115115
key = web.AppKey("key", int)
116-
assert repr(key) == "<AppKey(__main__.key, type=int)>"
116+
assert repr(key) in (
117+
"<AppKey(__channelexec__.key, type=int)>", # pytest-xdist
118+
"<AppKey(__main__.key, type=int)>",
119+
)
117120
key = web.AppKey("key", web.Request)
118-
assert repr(key) == "<AppKey(__main__.key, type=aiohttp.web_request.Request)>"
121+
assert repr(key) in (
122+
# pytest-xdist:
123+
"<AppKey(__channelexec__.key, type=aiohttp.web_request.Request)>",
124+
"<AppKey(__main__.key, type=aiohttp.web_request.Request)>",
125+
)
119126

120127

121128
def test_appkey_repr_nonconcrete() -> None:
122129
key = web.AppKey("key", Iterator[int])
123-
assert repr(key) == "<AppKey(__main__.key, type=typing.Iterator[int])>"
130+
assert repr(key) in (
131+
# pytest-xdist:
132+
"<AppKey(__channelexec__.key, type=typing.Iterator[int])>",
133+
"<AppKey(__main__.key, type=typing.Iterator[int])>",
134+
)
124135

125136

126137
def test_appkey_repr_annotated() -> None:
127138
key = web.AppKey[Iterator[int]]("key")
128-
assert repr(key) == "<AppKey(__main__.key, type=typing.Iterator[int])>"
139+
assert repr(key) in (
140+
# pytest-xdist:
141+
"<AppKey(__channelexec__.key, type=typing.Iterator[int])>",
142+
"<AppKey(__main__.key, type=typing.Iterator[int])>",
143+
)
129144

130145

131146
def test_app_str_keys() -> None:

0 commit comments

Comments
 (0)