Aiohttp: ๋งค๊ฐœ ๋ณ€์ˆ˜ "loop_factory"๋Š” ๊ฐ„์ ‘ ๋˜๋Š” ํ•จ์ˆ˜ ์ž์ฒด๋ฅผ ํ†ตํ•ด ๋ช…์‹œ ์ ์œผ๋กœ ์„ ์–ธํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.

์— ๋งŒ๋“  2020๋…„ 03์›” 12์ผ  ยท  3์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: aio-libs/aiohttp

3.7.2์—์„œ 3.8.1๋กœ ์—…๊ทธ๋ ˆ์ด๋“œํ•˜๋ ค๊ณ  ์‹œ๋„ํ•˜๊ณ  ํ…Œ์ŠคํŠธ ๊ฒ€์ƒ‰์œผ๋กœ py.test์—์„œ ๋‹ค์Œ์„๋ณด๊ธฐ ์‹œ์ž‘ํ–ˆ์Šต๋‹ˆ๋‹ค.

๋งค๊ฐœ ๋ณ€์ˆ˜ "loop_factory"๋Š” ๊ฐ„์ ‘ ๋˜๋Š” ํ•จ์ˆ˜ ์ž์ฒด๋ฅผ ํ†ตํ•ด ๋ช…์‹œ ์ ์œผ๋กœ ์„ ์–ธํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.

๊ณตํ†ต์ ์€ ๋น„๋™๊ธฐ ํ•จ์ˆ˜์˜€์œผ๋ฉฐ aiohttp ๋‚ด ์–ด๋”˜๊ฐ€์—์„œ ๋ฐœ์ƒํ•œ ๊ฒƒ์œผ๋กœ ๋ณด์ž…๋‹ˆ๋‹ค. ๋‚˜๋Š” asyncio ๋˜๋Š” aiohttp์— ์ต์ˆ™ํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ์ง€์นจ์— ๋”ฐ๋ผ ๋” ๋งŽ์ด ๋””๋ฒ„๊น… ํ•  ์ˆ˜ ์žˆ์ง€๋งŒ ๋ˆ„๊ตฐ๊ฐ€ ์—ฌ๊ธฐ์—์„œ ๋” ๋งŽ์€ ์ƒ๊ฐ์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ๊ธฐ๋ฅผ ๋ฐ”๋ž๋‹ˆ๋‹ค.

๊ด€๋ จ ํŒจํ‚ค์ง€ :

aiohttp==3.6.2
pytest==5.4.0
pytest-aiohttp==0.3.0
pytest-cov==2.8.1
pytest-forked==1.1.3
pytest-mock==2.0.0
pytest-responses==0.4.0
pytest-xdist==1.31.0

์ฝœ ์Šคํƒ์— ๋Œ€ํ•œ ๋ช‡ ๊ฐ€์ง€ ์„ธ๋ถ€ ์‚ฌํ•ญ :

โžœ  ~/D/zeus (feat/increase-lru-cache) โœ— py.test -x --pdb
=========================================================================================== test session starts ============================================================================================
platform darwin -- Python 3.8.1, pytest-5.4.0, py-1.8.1, pluggy-0.13.1
rootdir: /Users/dcramer/Development/zeus, inifile: setup.cfg
plugins: mock-2.0.0, celery-4.1.1, xdist-1.31.0, aiohttp-0.3.0, forked-1.1.3, responses-0.4.0, cov-2.8.1
collecting 186 items
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
In function "test_health_check":
Parameter "loop_factory" should be declared explicitly via indirect or in function itself
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB post_mortem (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> /Users/dcramer/Development/zeus/.venv/lib/python3.8/site-packages/_pytest/python.py(1144)_validate_explicit_parameters()
-> fail(msg, pytrace=False)
(Pdb) l
1139                    func_name = self.function.__name__
1140                    msg = (
1141                        'In function "{func_name}":\n'
1142                        'Parameter "{arg}" should be declared explicitly via indirect or in function itself'
1143                    ).format(func_name=func_name, arg=arg)
1144 ->                 fail(msg, pytrace=False)
1145
1146
1147    def _find_parametrized_scope(argnames, arg2fixturedefs, indirect):
1148        """Find the most appropriate scope for a parametrized call based on its arguments.
1149
(Pdb) u
> /Users/dcramer/Development/zeus/.venv/lib/python3.8/site-packages/_pytest/python.py(939)parametrize()
-> self._validate_explicit_parameters(argnames, indirect)
(Pdb) l
934
935             self._validate_if_using_arg_names(argnames, indirect)
936
937             arg_values_types = self._resolve_arg_value_types(argnames, indirect)
938
939  ->         self._validate_explicit_parameters(argnames, indirect)
940
941             # Use any already (possibly) generated ids with parametrize Marks.
942             if _param_mark and _param_mark._param_ids_from:
943                 generated_ids = _param_mark._param_ids_from._param_ids_generated
944                 if generated_ids is not None:
(Pdb) u
> /Users/dcramer/Development/zeus/.venv/lib/python3.8/site-packages/aiohttp/pytest_plugin.py(203)pytest_generate_tests()
-> metafunc.parametrize("loop_factory",
(Pdb) l
198                         "Unknown loop '%s', available loops: %s" % (
199                             name, list(factories.keys())))
200                 else:
201                     continue
202             factories[name] = avail_factories[name]
203  ->     metafunc.parametrize("loop_factory",
204                              list(factories.values()),
205                              ids=list(factories.keys()))
206
207
208     @pytest.fixture

๋ชจ๋“  3 ๋Œ“๊ธ€

์ง€๊ธˆ 3.7.2์—์„œ ๋ณผ ์ˆ˜ ์žˆ๋“ฏ์ด ์ด๊ฒƒ์€ ์‹ค์ œ๋กœ 3.8.x์™€ ๊ด€๋ จ์ด ์—†์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ณ„์† ์–‘๋ถ„ ํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค.

์ด๋Š” pytest==5.4.0 ์˜ ๋ฆด๋ฆฌ์Šค๋กœ ์ธํ•ด ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ๋ฐฉ๊ธˆ ๋ถˆ์— ํƒ€์„œ pytest<5.4 ๋กœ ๋กค๋ฐฑํ•˜๋ฉด ๋ฌธ์ œ๊ฐ€ ํ•ด๊ฒฐ๋ฉ๋‹ˆ๋‹ค.

๋„ค ๋ง์ด ๋งž์•„์š”. ๋‚ด ๋””๋ฒ„๊น…์—์„œ ๊ทธ ์ •๋„๊นŒ์ง€ ์–ป์—ˆ์Šต๋‹ˆ๋‹ค. :).

๋ฐ”๋ผ๊ฑด๋Œ€ ์ด๊ฒƒ์€ ๋ˆ„๊ตฐ๊ฐ€ ์ธํ„ฐ๋„ท ๊ฒ€์ƒ‰์— ๋„์›€์ด๋˜๊ธฐ๋ฅผ ๋ฐ”๋ž๋‹ˆ๋‹ค. pytest์—์„œ ๋ถ„๋ฅ˜ํ•ฉ๋‹ˆ๋‹ค.

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰