Is there a way to test a later code example that relies on an earlier one?

Open
#55 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python

Research direction

Start by reading the plugin's markdown example extraction and execution flow, then check how independently tested snippets are represented. Define how a later snippet can declare dependence on an earlier one, and add coverage showing that the earlier code is included when the later example is tested.

Written by the indexing model from the issue text.

Description

This is an awesome library - thanks for creating and maintaining it!

If I have a markdown doc that has 2 code snippets, is there any way to mark that the second one relies on the first one and therefore, in order to test the second example you need to take the code from the first example too?

E.g. test.md

You can import environment variables like this:

import os
s.environ.get("MY_ENV_VAR")

And you can also specify a default value:

s.environ.get("MY_ENV_VAR", "default")
Dominant language
Python
Stars
181
Forks
29
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pydantic/pytest-examples

All issues in pydantic/pytest-examples

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.