From 2dac25f1b3c8ed0acf3a97b1ea607293cbb7c2f4 Mon Sep 17 00:00:00 2001 From: Fede Kamelhar Date: Fri, 4 Jul 2025 10:52:51 -0400 Subject: [PATCH] docs:Improve the contributing.md for testing purposes docs:Improve the contributing.md for testing purposes --- CONTRIBUTING.md | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 030b60f21..4b35b112b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -83,17 +83,46 @@ Then to install: $ pip install ./path-to-wheel-file.whl ``` -## Running tests +## Running Tests -Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. +Most tests require a mock server to be set up against the OpenAPI specification. Follow these steps to get your test environment ready: + +### Setup Instructions + +### 1. Download the OpenAPI Specification + +First, locate the latest valid OpenAPI specification URL in `.stats.yml` and download it: + +```sh +# Download the openapi_spec_url from .stats.yml (use the latest valid version) +curl -o openapi.yml [URL_FROM_STATS_YML] +``` + +### 2. Copy the Specification File + +Move the downloaded OpenAPI specification to the main project directory: ```sh -# you will need npm installed -$ npx prism mock path/to/your/openapi.yml +cp openapi.yml path/to/anthropic-sdk-python/ ``` +### 3. Start the Mock Server + +Use [Prism](https://github.com/stoplightio/prism) to create a mock server from the OpenAPI specification: + +```sh +# Ensure you have npm installed, then run: +npx prism mock openapi.yml +``` + +The mock server will start and provide endpoints based on your OpenAPI specification. + +### 4. Run Tests + +With the mock server running, execute the test suite: + ```sh -$ ./scripts/test +./scripts/test ``` ## Linting and formatting