setup-web-tests

Official

Set up Python test env for Claude Code web.

AuthorPostHog
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill automates configuring a Python test environment in Claude Code for web when flox is unavailable, enabling backend test execution without manual setup.

Core Features & Use Cases

  • Detects the required Python version from pyproject.toml and matches it against a python-build-standalone release.
  • Downloads and installs a compatible Python interpreter, then prepares a reusable test runtime for pytest-based workflows.
  • Use cases include running backend tests for web projects where standard runtimes are unavailable or inconsistent, and validating Python compatibility across environments.

Quick Start

Follow these steps to set up and run tests in Claude Code for web:

REQUIRED_VERSION=$(grep requires-python pyproject.toml | grep -oP '[\d.]+') echo "Required Python: $REQUIRED_VERSION"

RELEASE_TAG=$(curl -sL "https://api.github.com/repos/astral-sh/python-build-standalone/releases/latest" | grep '"tag_name"' | cut -d'"' -f4)

DOWNLOAD_URL=$(curl -sL "https://api.github.com/repos/astral-sh/python-build-standalone/releases/latest" |
grep "browser_download_url" | grep "$REQUIRED_VERSION" | grep "x86_64-unknown-linux-gnu-install_only.tar.gz" | head -1 | cut -d'"' -f4)

mkdir -p /tmp/python-install && cd /tmp/python-install curl -L -o python.tar.gz "$DOWNLOAD_URL" tar -xzf python.tar.gz

Verify

/tmp/python-install/python/bin/python3 --version

Setup and run tests

cd /home/user/posthog uv sync --python /tmp/python-install/python/bin/python3 source .venv/bin/activate

Run a specific test

pytest path/to/test.py::TestClass::test_method -v

Run all tests in a directory

pytest posthog/hogql/test/ -v

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: setup-web-tests
Download link: https://github.com/PostHog/posthog/archive/main.zip#setup-web-tests

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.