Skip to content

Commit cbc8657

Browse files
Rename test fixtures for consistency between sync and async
1 parent 560eb5d commit cbc8657

File tree

3 files changed

+39
-93
lines changed

3 files changed

+39
-93
lines changed

tests/conftest.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ def repository_id():
129129

130130

131131
@pytest.fixture
132-
def get_mock_github_api():
133-
def _get_mock_github_api(return_data, installation_id=12345):
132+
def aget_mock_github_api():
133+
def _aget_mock_github_api(return_data, installation_id=12345):
134134
mock_api = AsyncMock(spec=AsyncGitHubAPI)
135135

136136
async def mock_getitem(*args, **kwargs):
@@ -148,12 +148,12 @@ async def mock_getiter(*args, **kwargs):
148148

149149
return mock_api
150150

151-
return _get_mock_github_api
151+
return _aget_mock_github_api
152152

153153

154154
@pytest.fixture
155-
def get_mock_github_api_sync():
156-
def _get_mock_github_api_sync(return_data, installation_id=12345):
155+
def get_mock_github_api():
156+
def _get_mock_github_api(return_data, installation_id=12345):
157157
from django_github_app.github import SyncGitHubAPI
158158

159159
mock_api = MagicMock(spec=SyncGitHubAPI)
@@ -174,15 +174,15 @@ def mock_post(*args, **kwargs):
174174

175175
return mock_api
176176

177-
return _get_mock_github_api_sync
177+
return _get_mock_github_api
178178

179179

180180
@pytest.fixture
181-
def installation(get_mock_github_api, baker):
181+
def installation(aget_mock_github_api, baker):
182182
installation = baker.make(
183183
"django_github_app.Installation", installation_id=seq.next()
184184
)
185-
mock_github_api = get_mock_github_api(
185+
mock_github_api = aget_mock_github_api(
186186
[
187187
{"id": seq.next(), "node_id": "node1", "full_name": "owner/repo1"},
188188
{"id": seq.next(), "node_id": "node2", "full_name": "owner/repo2"},
@@ -194,11 +194,11 @@ def installation(get_mock_github_api, baker):
194194

195195

196196
@pytest_asyncio.fixture
197-
async def ainstallation(get_mock_github_api, baker):
197+
async def ainstallation(aget_mock_github_api, baker):
198198
installation = await sync_to_async(baker.make)(
199199
"django_github_app.Installation", installation_id=seq.next()
200200
)
201-
mock_github_api = get_mock_github_api(
201+
mock_github_api = aget_mock_github_api(
202202
[
203203
{"id": seq.next(), "node_id": "node1", "full_name": "owner/repo1"},
204204
{"id": seq.next(), "node_id": "node2", "full_name": "owner/repo2"},
@@ -210,14 +210,14 @@ async def ainstallation(get_mock_github_api, baker):
210210

211211

212212
@pytest.fixture
213-
def repository(installation, get_mock_github_api, baker):
213+
def repository(installation, aget_mock_github_api, baker):
214214
repository = baker.make(
215215
"django_github_app.Repository",
216216
repository_id=seq.next(),
217217
full_name="owner/repo",
218218
installation=installation,
219219
)
220-
mock_github_api = get_mock_github_api(
220+
mock_github_api = aget_mock_github_api(
221221
[
222222
{
223223
"number": 1,
@@ -237,14 +237,14 @@ def repository(installation, get_mock_github_api, baker):
237237

238238

239239
@pytest_asyncio.fixture
240-
async def arepository(ainstallation, get_mock_github_api, baker):
240+
async def arepository(ainstallation, aget_mock_github_api, baker):
241241
repository = await sync_to_async(baker.make)(
242242
"django_github_app.Repository",
243243
repository_id=seq.next(),
244244
full_name="owner/repo",
245245
installation=ainstallation,
246246
)
247-
mock_github_api = get_mock_github_api(
247+
mock_github_api = aget_mock_github_api(
248248
[
249249
{
250250
"number": 1,

0 commit comments

Comments
 (0)