Skip to content

Commit 23fcea8

Browse files
committed
refactor: Use conftest.py for defining fixtures
1 parent 5df8056 commit 23fcea8

9 files changed

Lines changed: 6 additions & 50 deletions

File tree

src/tests/test_e2e.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# ruff: noqa: F811 ruff recognizes fixture use as argument as redefinition
21
import asyncio
32
import json
43
from logging import Logger
@@ -11,13 +10,8 @@
1110
from uvicorn import Config, Server
1211

1312
from src.server import app
13+
from src.tests.conftest import MockShelf
1414
from src.tests.test_integration.test_bot import RestClientContextManagerMock
15-
from src.tests.utils import ( # noqa: F401 ruff recognizes fixture import as unused
16-
MockShelf,
17-
forum_channel_mock,
18-
full_post_mock,
19-
rest_client_mock,
20-
)
2115
from src.utils.signature_verification import generate_signature
2216

2317

src/tests/test_integration/test_bot.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
# ruff: noqa: F811 ruff recognizes fixture use as argument as redefinition
21
import asyncio
32
from unittest.mock import AsyncMock, mock_open, patch
43

54
from hikari import RESTApp
65
from hikari.impl import RESTClientImpl
76

87
from src.bot import run
9-
from src.tests.utils import ( # noqa: F401 ruff recognizes fixture import as unused
10-
MockShelf,
11-
RestClientContextManagerMock,
12-
forum_channel_mock,
13-
rest_client_mock,
14-
)
8+
from src.tests.conftest import MockShelf, RestClientContextManagerMock
159
from src.utils.data_types import ProjectItemEvent
1610

1711

src/tests/test_integration/test_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from fastapi.testclient import TestClient
99

1010
from src.server import app
11-
from src.tests.utils import MockResponse, MockShelf
11+
from src.tests.conftest import MockResponse, MockShelf
1212
from src.utils.signature_verification import generate_signature
1313

1414
test_client = TestClient(app)

src/tests/test_unit/test_bot.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# ruff: noqa: F811 ruff recognizes fixture use as argument as redefinition
21
import asyncio
32
import logging
43
from unittest.mock import ANY, AsyncMock, patch
@@ -8,18 +7,8 @@
87
from hikari.impl import RESTClientImpl
98

109
from src import bot
11-
from src.tests.utils import ( # noqa: F401 ruff recognizes fixture import as unused
12-
RestClientContextManagerMock,
13-
forum_channel_mock,
14-
full_post_mock,
15-
post_mock,
16-
rest_client_mock,
17-
shared_forum_channel_mock,
18-
user_text_mention,
19-
)
20-
from src.utils.data_types import (
21-
SimpleProjectItemEvent,
22-
)
10+
from src.tests.conftest import RestClientContextManagerMock
11+
from src.utils.data_types import SimpleProjectItemEvent
2312
from src.utils.error import ForumChannelNotFound
2413

2514

src/tests/test_unit/test_process.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
# ruff: noqa: F811 ruff recognizes fixture use as argument as redefinition
21
from unittest.mock import AsyncMock, mock_open, patch
32

43
from hikari import ForumTag, Snowflake
54
from hikari.impl import RESTClientImpl
65

7-
from src.tests.utils import ( # noqa: F401 ruff recognizes fixture import as unused
8-
forum_channel_mock,
9-
full_post_mock,
10-
post_mock,
11-
rest_client_mock,
12-
shared_forum_channel_mock,
13-
user_text_mention,
14-
)
156
from src.utils.data_types import (
167
ProjectItemEditedAssignees,
178
ProjectItemEditedBody,

src/tests/test_unit/test_utils/test_discord_rest_client.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
# ruff: noqa: F811 ruff recognizes fixture use as argument as redefinition
21
from unittest.mock import AsyncMock, patch
32

43
from hikari import ForumTag, Snowflake
54
from hikari.impl import RESTClientImpl
65

7-
from src.tests.utils import ( # noqa: F401 ruff recognizes fixture import as unused
8-
MockShelf,
9-
forum_channel_mock,
10-
post_mock,
11-
rest_client_mock,
12-
)
6+
from src.tests.conftest import MockShelf
137
from src.utils import discord_rest_client
148

159

src/tests/test_unit/test_utils/test_misc.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
# ruff: noqa: F811 ruff recognizes fixture use as argument as redefinition
21
import asyncio
32
import logging
43
from io import StringIO
54
from unittest.mock import mock_open, patch
65

7-
from src.tests.utils import ( # noqa: F401 ruff recognizes fixture import as unused
8-
forum_channel_mock,
9-
shared_forum_channel_mock,
10-
)
116
from src.utils import misc
127

138

src/tests/test_unit/test_utils/test_signature_verification.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# ruff: noqa: F811 ruff recognizes fixture use as argument as redefinition
21
from logging import Logger
32
from unittest.mock import patch
43

0 commit comments

Comments
 (0)