You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
make test# full suite
pytest -s tests/api/test_usdc.py # single file
pytest -s tests/api/test_usdc.py::test_mint_usdc # single test
pytest -s -m integration # live network only
All tests use pytest. pytest.ini streams logs at INFO level on every run — no -v flag needed.
Test layers:
┌──────────────────────────┐
│ Integration (live net) │ @pytest.mark.integration
│ test_polymarket_sync │ hits Gamma API + Polygon RPC
│ test_conditional_token │ not run by default
└──────────────────────────┘
┌──────────────────────────────────────────┐
│ FastAPI / HTTP layer │ make test
│ [TestClient](https://fastapi.tiangolo.com/tutorial/testing/) + in-memory SQLite │
│ test_usdc · test_positions · test_markets│
│ test_lifecycle · test_resolution · etc. │
└──────────────────────────────────────────┘
┌──────────────────────────────────────────────────────┐
│ py_clob_client utilities │ make test
│ test_utilities.py — orderbook parsing, order_to_json │
└──────────────────────────────────────────────────────┘
Layout
tests/
├── test_utilities.py # py_clob_client utility helpers
├── fastapi/ # AgentPit HTTP API (FastAPI TestClient)
│ ├── test_basic.py # GET /
│ ├── test_create_user.py # POST /create_user
│ ├── test_personality.py # POST /create_personality
│ ├── test_create_agent.py # POST /create_agent
│ ├── test_markets.py # GET + POST /markets, GET /markets/{id}
│ ├── test_usdc.py # mint, balance, transfer
│ ├── test_positions.py # split_position, merge_positions
│ ├── test_resolution.py # resolve + redeem_position
│ ├── test_lifecycle.py # state machine transitions + cancel
│ ├── test_history.py # transaction history
│ ├── test_portfolio.py # portfolio summary
│ └── test_main.py # backward-compat re-export of test_portfolio
└── polymarket/
├── test_polymarket_sync.py # Gamma API sync (live)
└── test_conditional_token_framework.py # CTF reads (live Polygon RPC)
3 users → all api_key and eth_address values unique
test_personality.py
Tests POST /create_personality — the endpoint that registers an OpenClaw agent personality (the strategy spec OpenClaw uses to drive an agent's decisions: beliefs, methods, needs).
Test
Checks
test_create_personality
Returns all fields; spec contains beliefs, methods, needs
test_create_personality_missing_field
Missing needs → 422
test_create_personality_empty_title
Empty title → 400 via check_state
test_create_agent.py
Tests POST /create_agent — the endpoint that instantiates an OpenClaw agent by linking an agent_id to an existing personality. AgentPit persists the agent's state, history, and todo so OpenClaw can maintain continuity across sessions.
OrderService — only exercised by tests/onchain/test_trade_flow.py against a real Anvil chain; no isolated unit tests for the matching loop, balance pre-flight, or _settle_on_chain failure path
PredictionMarket.split/merge — server calls simulators directly, bypassing this class
See Also
ONBOARDING.md — how to run tests, in-memory SQLite pattern, first-contribution guide
high_level_design.md — component overview to orient you before reading test files
agentpit_api.md — endpoint reference; each endpoint has at least one test