File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -8,13 +8,26 @@ pytest + pytest-asyncio with mock server responses.
88| ------| ----------|
99| Test patterns | tests/* .py |
1010| Mock responses | tests/static/responses.py |
11- | Fixtures | Conftest in each test file |
11+ | Fixtures | tests/conftest.py - BaseTest class |
1212
1313## CONVENTIONS
14- - asyncio_mode = auto (pytest.ini )
14+ - asyncio_mode = auto (pyproject.toml )
1515- API_KEY from env or mock
1616- Each captcha type has dedicated test file
17- - Mock server responses in static/responses.py
17+ - Test class naming: ` Test<CaptchaType> `
18+ - Method naming: ` test_sio_* ` (sync), ` test_aio_* ` (async)
19+ - Response validation: ` GetTaskResultResponseSer ` from serializer
20+
21+ ## TEST PATTERNS
22+ - ** BaseTest class** : Provides ` get_proxy_args() ` , ` read_file() ` , delay fixtures
23+ - ** Parametrized tests** : ` @pytest.mark.parametrize ` for proxy types, captcha types
24+ - ** Mocking** : ` mocker.patch() ` and ` mocker.spy() ` from pytest-mock
25+ - ** Context managers** : Test via ` mocker.spy(ContextManager, "__enter__") `
26+ - ** Assertions** : ` isinstance(result, dict) ` + serializer validation
27+
28+ ## ANTI-PATTERNS
29+ - Don't skip BaseTest inheritance unless truly needed
30+ - Don't use real API calls in unit tests (use mocker)
1831
1932## COMMANDS
2033``` bash
You can’t perform that action at this time.
0 commit comments