Run integration tests

From blockscout/mcp-server · View interactive version

Run integration tests is an AI agent skill from the GitHub repository blockscout/mcp-server. Use this skill WHENEVER you are about to run the integration tests of this project — the whole suite, a single module, or one test. This includes any time you would otherwise type `pytest -m integration`, `uv run pytest -m integration`, run anything under `tests/integration/`, or want to check live

How to use this skill

Skill file

Run Integration Tests (timeout-protected)

Why use this instead of plain pytest

Integration tests hit live external APIs and the HTTP client has **no hard

request timeout**. When an endpoint is slow or unresponsive, a single test can

hang indefinitely — a plain pytest -m integration run then blocks for an

unbounded time and so do you. (This is exactly how this project's suite started

taking 20+ minutes: a handful of tests hung for ~3 minutes each before being

killed manually.)

The bundled runner solves this by executing **each test in its own subprocess

with a per-test wall-clock timeout**. A hung test is killed and reported as

TIMEOUT; the run continues. You always get a complete, bounded report instead

of stalling.

Usage

The runner lives at scripts/run_integration_tests.py (relative to the project

root, alongside the project's other tooling). Invoke it from the project root

with that path, or use its absolute path. The script finds the project root on

its own by walking up to the nearest tests/integration directory, so it can be

launched from anywhere.

Run it with the project venv (the script auto-detects whether to use pytest

directly inside the devcontainer or uv run pytest on the host):

uv run python scripts/run_integration_tests.py [TARGET ...] [--timeout N] [--slow-threshold S]

Inside the devcontainer (/.dockerenv exists) you may drop uv run and call

python ... directly — but uv run python ... works in both environments, so

prefer it when unsure.

The three granularities

TARGET is passed straight to pytest's collector, so the same command covers

every scope:

1. Whole suite (no target → defaults to tests/integration):

uv run python scripts/run_integration_tests.py

2. A single module (a file, or a whole subdirectory):

# one file
uv run python scripts/run_integration_tests.py tests/integration/block/test_get_block_info_real.py
# a category directory
uv run python scripts/run_integration_tests.py tests/integration/transaction

3. A single test (a file::test node id):

uv run python scripts/run_integration_tests.py "tests/integration/block/test_get_block_info_real.py::test_get_block_info_integration"

You can also pass several targets at once.

Options

(e.g. --timeout 30) when you just want to fail fast on hangs; raise it only

if a test legitimately needs longer.

summary (default 10).

run before launching it.

Reading the output

Each test prints a live line as it finishes:

[  7/83] PASS         2.5s  tests/integration/...::test_x
[  8/83] TIMEOUT    120.0s  tests/integration/...::test_y

The summary at the end reports counts and three actionable lists:

first thing to investigate (usually a flaky/slow endpoint or a missing HTTP

timeout in the tool code, not a bug in the test).

(network unavailable, missing API key, external service down, …). A skip is an

environment signal, not a pass, so read these before treating a run as clean.

for optimization.

The script exits non-zero if anything failed or timed out, so it composes with

other tooling.

Tips

much faster than the full suite and still timeout-protected.

temporarily slow; re-running often shows the same test passing in a couple of

seconds. Treat persistent timeouts (across reruns) as the real signal.

per-test startup cost. That overhead is the deliberate price of guaranteed

non-blocking behavior; it is negligible compared to a single hung test.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.