Skip to content

Commit 0bca481

Browse files
committed
fixing tests
1 parent 6f9913b commit 0bca481

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

packages/service-library/tests/aiohttp/test_application_setup.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,45 +36,41 @@ def app_config() -> dict:
3636

3737

3838
@pytest.fixture
39-
def app(app_config) -> web.Application:
39+
def app(app_config: dict) -> web.Application:
4040
_app = web.Application()
4141
_app[APP_CONFIG_KEY] = app_config
4242
return _app
4343

4444

4545
@pytest.fixture
46-
def create_setup_bar() -> Callable[[web.Application, str, bool], bool]:
46+
def create_setup_bar() -> Callable[[web.Application], bool]:
4747
@app_module_setup("package.bar", ModuleCategory.ADDON)
48-
def _setup_bar(
49-
app: web.Application, arg1: str, *, raise_skip: bool = False
50-
) -> bool:
48+
def setup_bar(app: web.Application) -> bool:
5149
return True
5250

53-
return _setup_bar
51+
return setup_bar
5452

5553

5654
@pytest.fixture
57-
def create_setup_foo() -> Callable[[web.Application, str, bool], bool]:
58-
@app_module_setup("package.foo", ModuleCategory.ADDON)
59-
def _setup_foo(
60-
app: web.Application, arg1: str, *, raise_skip: bool = False, **kwargs
61-
) -> bool:
55+
def create_setup_foo(mock_logger: MockType) -> Callable[[web.Application], bool]:
56+
@app_module_setup("package.foo", ModuleCategory.ADDON, logger=mock_logger)
57+
def setup_foo(app: web.Application, *, raise_skip: bool = False) -> bool:
6258
if raise_skip:
6359
raise SkipModuleSetupError(reason="explicit skip")
6460
return True
6561

66-
return _setup_foo
62+
return setup_foo
6763

6864

6965
@pytest.fixture
70-
def create_setup_zee() -> Callable[[web.Application, str, int], bool]:
66+
def create_setup_zee() -> Callable[[web.Application, object, int], bool]:
7167
@app_module_setup(
7268
"package.zee", ModuleCategory.ADDON, config_enabled="main.zee_enabled"
7369
)
74-
def _setup_zee(app: web.Application, arg1: str, kargs: int = 55) -> bool:
70+
def setup_zee(app: web.Application, arg1, kargs=55) -> bool:
7571
return True
7672

77-
return _setup_zee
73+
return setup_zee
7874

7975

8076
@pytest.fixture
@@ -153,7 +149,9 @@ def test_skip_setup(
153149
mock_logger.info.assert_called()
154150

155151

156-
def test_ensure_single_setup_runs_once(app: web.Application, mock_logger: Mock) -> None:
152+
def test_ensure_single_setup_runs_once(
153+
app: web.Application, mock_logger: MockType
154+
) -> None:
157155
decorated = ensure_single_setup("test.module", logger=mock_logger)(setup_basic)
158156

159157
# First call succeeds
@@ -170,7 +168,7 @@ def test_ensure_single_setup_runs_once(app: web.Application, mock_logger: Mock)
170168

171169

172170
def test_ensure_single_setup_error_handling(
173-
app: web.Application, mock_logger: Mock
171+
app: web.Application, mock_logger: MockType
174172
) -> None:
175173
decorated = ensure_single_setup("test.error", logger=mock_logger)(setup_that_raises)
176174

@@ -180,7 +178,7 @@ def test_ensure_single_setup_error_handling(
180178

181179

182180
def test_ensure_single_setup_multiple_modules(
183-
app: web.Application, mock_logger: Mock
181+
app: web.Application, mock_logger: MockType
184182
) -> None:
185183
decorated1 = ensure_single_setup("module1", logger=mock_logger)(setup_basic)
186184
decorated2 = ensure_single_setup("module2", logger=mock_logger)(setup_basic)

0 commit comments

Comments
 (0)