Skip to content

About

Runnable code examples for Python testing, pytest, FastAPI, and AI engineering articles on istranin.dev.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

32 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

istranin.dev — Code you can run. Python, testing, and AI engineering.

istranin.dev code examples

Runnable code examples for Python testing, pytest, FastAPI, and AI engineering articles on istranin.dev.

Test examples

Browse examples · Getting started · Articles · Courses

Each directory is a self-contained project with its own dependencies, pyproject.toml, and uv.lock. Read the corresponding article for the explanation, then use its example to run and explore the code.

Article examples

Example Topics Article
Pytest fixtures and mocking for AI agents Scripted models, OpenAI and Anthropic adapters, HTTP mocks, offline CI Read ↗
Your first pytest test Given-When-Then, plain assertions, failure reports, boundaries Read ↗
Python unit testing best practices Behavior, parametrization, explicit fixtures, autospecced collaborators Read ↗
GitHub Actions Python testing Python matrix, coverage, JUnit reports, stable merge check Read ↗
FastAPI testing with pytest API testing, TestClient, validation, boundary cases Read ↗
Behavior-driven development in Python with pytest-bdd Shared examples, Gherkin, scenario outlines, reservation outcomes, TDD integration Read ↗
LangGraph agent testing with pytest Agent graphs, tool calls, pytest-mock, failure paths Read ↗
Pytest hooks examples CLI options, markers, collection, hook wrappers, terminal reports Read ↗
Pytest mocking tutorial mocker, class and method patches, mock drift, lookup targets, decorators Read ↗
Pytest fixtures and parametrization Fixture architecture, factories, indirect setup, dynamic cases, scope costs, parallel workers Read ↗
Test-driven development in Python with pytest Red-green-refactor, exceptions, parametrization, state boundaries Read ↗
Unit testing vs integration testing vs E2E in Python Test boundaries, real configuration, subprocess CLI tests, regression and acceptance Read ↗

Open an example directory and follow its README to install the locked dependencies and run the code.

Getting started

You need Python 3.13 or newer and uv. Clone the repository and choose an example. For instance, to run the FastAPI tests:

git clone https://github.com/artem-istranin/istranin-dev-code-examples.git
cd istranin-dev-code-examples/fastapi-testing-pytest
uv sync --locked
uv run pytest test_main.py -v

Run commands inside the example directory. Each example keeps its own environment and locked dependencies; the repository root is a catalog. The example README includes its expected results and any additional commands or exercises.

Adding an example

Keep each example focused on its companion article and independently runnable. Follow the same README structure used throughout this repository:

  1. The istranin.dev wordmark, example title, and a direct link to the companion article.
  2. Overview — the example's purpose and scope.
  3. Requirements — Python, uv, and any example-specific prerequisites.
  4. Run the example — commands and expected results.
  5. Project files — a map of the relevant source, tests, and dependency files.
  6. Any article-specific walkthroughs, experiments, or sources, followed by the shared navigation footer.

Preserve each article's teaching content, include its pyproject.toml and uv.lock, and add the example and article links to the catalog above.

Author and license

Created by Artem Istranin. Find the full articles and practical courses on istranin.dev.

This repository is licensed under the Apache License 2.0.

About

Runnable code examples for Python testing, pytest, FastAPI, and AI engineering articles on istranin.dev.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages