Improve documentation for scenario tests (#795)

- Fix documentation of scenario test module
- Add instructions to scenario update script for local development
This commit is contained in:
Zanie Blue 2024-01-05 10:51:25 -06:00 committed by GitHub
parent 5820a9d937
commit 74777c01ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 26 deletions

View file

@ -1,11 +1,10 @@
//! DO NOT EDIT
//!
//! Generated with {{generated_with}}
//! Scenarios from <{{generated_from}}>
//!
#![cfg(all(feature = "python", feature = "pypi"))]
/// DO NOT EDIT
///
/// GENERATED WITH `{{generated_with}}`
/// SCENARIOS FROM `{{generated_from}}`
use std::path::Path;
use std::process::Command;

View file

@ -1,20 +1,41 @@
#!/usr/bin/env python3
#
# Generates and updates snapshot test cases from packse scenarios.
#
# Usage:
#
# $ ./scripts/scenarios/update.py
#
# Requirements:
#
# Requires `packse` and `chevron-blue`.
#
# $ pip install -r scripts/scenarios/requirements.txt
#
# Also supports a local, editable requirement on `packse`.
#
# Uses `git`, `rustfmt`, and `cargo insta test` requirements from the project.
"""
Generates and updates snapshot test cases from packse scenarios.
Usage:
Regenerate the scenario test file:
$ ./scripts/scenarios/update.py
Scenarios are pinned to a specific commit. Change the `PACKSE_COMMIT` constant to update them.
Scenarios can be developed locally with the following workflow:
Install the local version of packse
$ pip install -e <path to packse>
From the packse repository, build and publish the scenarios to a local index
$ packse index up --bg
$ packse build scenarios/*
$ packse publish dist/* --index-url http://localhost:3141/packages/local --anonymous
Override the default PyPI index for Puffin and update the scenarios
$ PUFFIN_INDEX_URL="http://localhost:3141/packages/all/+simple" ./scripts/scenarios/update.py
Requirements:
Requires `packse` and `chevron-blue`.
$ pip install -r scripts/scenarios/requirements.txt
Also supports a local, editable requirement on `packse`.
Uses `git`, `rustfmt`, and `cargo insta test` requirements from the project.
"""
import json
import shutil