com um clique
direct-tests
// Write and run fast direct-mode pytest tests for this repo's GenLayer intelligent contracts.
// Write and run fast direct-mode pytest tests for this repo's GenLayer intelligent contracts.
Design, deploy, and monitor a GenLayer Intelligent Oracle prediction market from any coding agent. Use when a user wants to create a settled-by-web-evidence prediction market without opening the web UI.
Deploy GenLayer intelligent contracts using the deployment script. User-invoked only.
Use the GenLayer CLI to inspect, interact with, and debug this repo's intelligent contracts.
Validate this repo's GenLayer intelligent contracts with the GenVM linter.
Run or design live-environment GenLayer tests for this intelligent-oracle repo.
Run tests and build checks across the intelligent-oracle project. Use after making changes to validate nothing is broken.
| name | direct-tests |
| description | Write and run fast direct-mode pytest tests for this repo's GenLayer intelligent contracts. |
| allowed-tools | ["Bash","Read","Write","Edit"] |
Use this skill for fast contract logic checks that do not need a live GenLayer network.
This repo keeps Python contract tests in test/, not tests/direct/. The tests use the genlayer-test pytest plugin fixtures plus helpers in test/tools/.
python3 -m venv .venv
. .venv/bin/activate
python -m pip install -r test/requirements.txt -q
test/requirements.txt includes genlayer-test, which provides the direct_* pytest fixtures.
Run all Python contract tests:
python -m pytest test/ -v
Run one file or one scenario:
python -m pytest test/test_football_prediction_market_with_evidence_success.py -v
python -m pytest test/test_football_prediction_market_with_evidence_success.py::test_name -v
Always lint contracts first when contract files changed:
genvm-lint check intelligent-contracts/*.py
Existing tests use direct-mode fixtures such as:
def test_example(direct_vm, direct_deploy, direct_alice, tmp_path):
...
Common fixtures include direct_vm, direct_deploy, direct_alice, direct_bob, direct_charlie, direct_owner, and direct_accounts.
Use test/tools/contracts.py for repo-specific helpers:
ORACLE_CONTRACT_PATHdeploy_oracle_direct(...)mock_oracle_resolution(...)read_contract_source(...)deploy_oracle_direct(...) rewrites the contract header to py-genlayer-multi:test for direct-mode compatibility. Prefer using that helper instead of duplicating deploy setup.
For gl.nondet.web.get():
direct_vm.mock_web(r".*", {"status": 200, "body": b"<html>result</html>"})
For gl.nondet.exec_prompt():
direct_vm.mock_llm(
r".*",
json.dumps(
{
"valid_source": "true",
"event_has_occurred": "true",
"reasoning": "mocked direct-mode resolution",
"outcome": "Bayern Munich",
}
),
)
Reset mocks between scenarios when needed:
direct_vm.clear_mocks()
UNDETERMINED, ERROR, and revert paths.Direct mode runs the leader path only. Use integration tests or a live Studio smoke test when validator consensus behavior is the thing being verified.