pydantic / pydantic/pytest-examples

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.

Dominant language
Python
Stars
178
Forks
25
Avg merge
4d 1h
Merged PRs (30d)
7

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")

Contributor guide

No contributing guide indexed for this repository

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.

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.