conflux-rust-integration-test
1
总安装量
1
周安装量
#49924
全站排名
安装命令
npx skills add https://github.com/conflux-fans/conflux-skills --skill conflux-rust-integration-test
Agent 安装分布
codex
1
Skill 文档
Pytest Integration Tests (Conflux Rust)
Quick workflow
- Choose location and reuse fixtures
- Pick the subdirectory under
integration_tests/tests(e.g.,rpc/,internal_contracts/,cross_space/,execution_spec_tests/). - Check for a local
conftest.pyand reuse/extend its fixtures.
- Pick framework and config
- Start from global fixtures in
integration_tests/tests/conftest.py(seereferences/fixtures.md). - If you need custom node counts or config, override
framework_classin your test module or localconftest.py. - Implement custom framework by subclassing
ConfluxTestFrameworkand overridingset_test_params()+setup_network().
- Create the test module
- Name the file with
testin it (e.g.,feature_test.py) underintegration_tests/tests/.... - Keep setup in fixtures; tests should rely on
network,cw3/ew3,core_accounts/evm_accounts, andinternal_contracts. - Prefer deterministic operations; avoid time-based sleeps unless no alternative exists.
- Add Python type hints for tests and fixtures.
- Implement the test
- Use
networkfor RPC and helpers; usenetwork.cw3/network.ew3for Web3 access. - Use helper utilities from
integration_tests/test_framework/util.py(e.g.,wait_until,assert_tx_exec_error). - Log via
network.log.info(...)instead of prints.
- Run and debug
- Run a single module:
uv run --no-sync pytest integration_tests/tests/path/to/test_file.py -vv - Filter by name:
uv run --no-sync pytest integration_tests/tests -k test_name - Show logs:
-s(avoid with-n), use--conflux-tracetxfor opcode traces. - Parallel:
-n logical --dist loadscope
Scope guidance
- Prefer
modulescope fornetworkand related fixtures; balances isolation and runtime. - Avoid
functionscope fornetwork(node startup is expensive). - Use
sessionscope only if tests fully reset state. - With xdist, prefer
--dist loadscopeso module-scoped fixtures stay within one worker.
Pitfalls we hit (and fixes)
uv runfailed with âfailed to open file …/.cache/uv/sdists-v9/.git: Operation not permittedâ: rerun with escalated permissions (sandbox needs access to~/.cache/uv).uv runtried to sync deps and failed buildinghive-py(metadata name mismatchethereum-hive): useuv run --no-sync ...for pytest runs to avoid dependency resolution.eth_getBlockByHash/eth_getBlockTransactionCountByHashreturnedBlockNotFoundright aftergenerate_custom_block: eSpace RPC may not see the block until execution; generate ~5 empty blocks afterward before querying.
Details and references
- Core fixtures and options:
references/fixtures.md - Pytest scope tradeoffs:
references/pytest-scope.md - Common interfaces, block execution notes, config hints, templates, and key files:
references/integration-test-notes.md
Resources
assets/
basic_test_template.py: Starter template for a new integration test module.custom_block_example.py: Minimal custom block example.