Skip to content

Conversation

@aorumbayev
Copy link
Contributor

@aorumbayev aorumbayev commented Nov 28, 2025

WIP draft, remaining polytest tests are still being implemented

Notes

- Only set format=msgpack when msgpack is explicitly selected
- Remove unnecessary format=json assignments for JSON-only endpoints
- Align with TypeScript client behavior
Generated output from updated client.py.j2 template:
- Remove format=json for endpoints that only support JSON
- Simplify msgpack format selection logic
- Reduce unnecessary query parameters
When dataclasses use slots=True and have fields named 'bytes' or 'type',
the class namespace contains member descriptors that interfere with
get_type_hints() evaluation.

Fix by passing explicit globalns with builtins and empty localns to
get_type_hints() to avoid the class namespace pollution.

Fixes TypeError: unsupported operand type(s) for |: 'member_descriptor' and 'NoneType'
The local_state_schema and global_state_schema fields may not always
be present in wire data from the ledger state delta endpoint.
Make them optional with default=None to handle missing fields gracefully.
Add Docker container-based mock server fixtures using testcontainers:
- MockServerContainer class to manage PollyJS mock server lifecycle
- Session-scoped fixtures for algod, indexer, and kmd mock servers
- Mock server replays pre-recorded HAR files for deterministic testing
- Fixtures automatically start/stop containers per test session
- Configure via POLYTEST_MOCK_SERVER_IMAGE and POLYTEST_RECORDINGS_PATH env vars
- Add test configuration constants matching TS mock server config
- Add testcontainers>=4.0.0 to dev dependencies for mock server containers
- Add polytest generate/validate tasks for algod, indexer, kmd clients
- Update transact polytest config to use algorandfoundation repo
- Add polytest-generate-all and polytest-validate-all aggregate tasks
- Add group_common_tests pytest marker for polytest test groups
- Install Rust toolchain and polytest CLI
- Run polytest-validate-algod to ensure test structure matches polytest config
- Validates that generated test files follow the expected naming conventions
Move manually written tests to tests/modules/algod_client/manual/ to
distinguish them from polytest-generated test stubs:
- test_block.py
- test_ledger_state_delta.py
- test_pending_transaction_information.py
- test_raw_transaction.py
- test_simulate_transactions.py
- test_suggested_params.py

Also fix localnet tests to use AlgorandClient.default_localnet().client.algod
consistently instead of mixing mock server with localnet transactions.
Add NOT IMPLEMENTED test stubs for algod client API endpoints:
- DELETE endpoints (catchup, ledger_sync)
- GET endpoints (boxes, state proofs, deltas, devmode, experimental, etc.)
- POST endpoints (catchup, ledger_sync, shutdown, teal, transactions)

All stubs are marked with @pytest.mark.skip(reason='Test not implemented')
and follow the polytest naming convention matching TypeScript tests.

These stubs serve as placeholders for future test implementation and
ensure structural parity with algokit-utils-ts polytest suite.
- Implement test_get_genesis.py, test_get_health.py, test_get_versions.py
- Implement test_get_v2_status.py, test_get_v2_ledger_supply.py
- Implement test_get_v2_transactions_params.py
- Implement test_get_v2_accounts_address.py with localnet
- Implement test_get_v2_blocks_round.py with mainnet/testnet endpoints
- Implement test_get_v2_deltas_round.py with mainnet endpoint
- Skip msgpack-related tests matching TypeScript approach
- All tests verify client methods return correct model types
- Move indexer and kmd integration tests to manual/ folders
- These tests require localnet with indexer/kmd, not mock server
- Update tests to use localnet clients directly
- Add E501, W292, I001 lint ignores for tests/modules/**/* in pyproject.toml
- Fix trailing newlines in polytest stub files (pre-commit format)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants