Skip to content

Commit 7b18338

Browse files
committed
test: update test_gitlab to use brand new fixtures
1 parent 090af39 commit 7b18338

File tree

2 files changed

+81
-122
lines changed

2 files changed

+81
-122
lines changed

gitlab/tests/conftest.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,19 @@
44

55
from gitlab import AsyncGitlab, Gitlab
66

7-
gitlab_kwargs = {
8-
"url": "http://localhost",
9-
"private_token": "private_token",
10-
"api_version": 4,
11-
}
12-
13-
14-
@pytest.fixture(
15-
params=[Gitlab(**gitlab_kwargs), AsyncGitlab(**gitlab_kwargs)],
16-
ids=["sync", "async"],
17-
)
18-
def gl(request):
7+
8+
@pytest.fixture(params=[Gitlab, AsyncGitlab], ids=["sync", "async"])
9+
def gitlab_class(request):
1910
return request.param
2011

2112

13+
@pytest.fixture
14+
def gl(gitlab_class):
15+
return gitlab_class(
16+
"http://localhost", private_token="private_token", api_version=4
17+
)
18+
19+
2220
async def awaiter(v):
2321
if asyncio.iscoroutine(v):
2422
return await v
@@ -33,6 +31,10 @@ async def returner(v):
3331
@pytest.fixture
3432
def gl_get_value(gl):
3533
"""Fixture that returns async function that either return input value or awaits it
34+
35+
Result function is based on client not the value of function argument,
36+
so if we accidentally mess up with return gitlab client value, then
37+
we will know
3638
3739
Usage::
3840

0 commit comments

Comments
 (0)