# opula1234/learn_pytest architecture

> Architecture diagram of the GitHub repository opula1234/learn_pytest, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/opula1234/learn_pytest
- Repository: https://github.com/opula1234/learn_pytest

## Overview

Pytest Interactive Sandbox is a hands-on curriculum, not a standalone application: learners run lesson tests to explore Python behavior and pytest techniques. Its workflow progresses from basic assertions, through fixtures, parameterized validation, and mocking, to a shopping-cart TDD challenge. The graph treats the tests as product content because they are the exercises described in the README. Source excerpts show the calculator, fixture setup, validator, weather service, and cart; connections involving unexcerpted test files are based on the documented curriculum and lesson commands.

Main entry points: [`04_mocking/weather_service.py`](https://github.com/opula1234/learn_pytest/blob/main/04_mocking/weather_service.py) (Weather Advice), [`04_mocking/test_weather.py`](https://github.com/opula1234/learn_pytest/blob/main/04_mocking/test_weather.py) (Mocking Tests), [`01_basics/test_calculator.py`](https://github.com/opula1234/learn_pytest/blob/main/01_basics/test_calculator.py) (Basics Tests), [`02_fixtures/test_fixtures.py`](https://github.com/opula1234/learn_pytest/blob/main/02_fixtures/test_fixtures.py) (Fixture Tests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_fundamentals["Core Testing"]
  node_basics_tests["Basics Tests<br/>[test_calculator.py]"]
  node_calculator["Calculator<br/>[calculator.py]"]
end

subgraph group_patterns["Pytest Patterns"]
  node_fixture_tests["Fixture Tests<br/>[test_fixtures.py]"]
  node_fixture_setup["Fixture Setup<br/>[conftest.py]"]
  node_user_db[("Mock User Database<br/>[db.py]")]
  node_validator_tests["Validation Tests<br/>[test_validator.py]"]
  node_validator["Input Validator<br/>[validator.py]"]
end

subgraph group_exercises["Applied Exercises"]
  node_weather_tests["Mocking Tests<br/>[test_weather.py]"]
  node_weather_advice["Weather Advice<br/>[weather_service.py]"]
  node_cart_tests["Cart Challenge Tests"]
  node_shopping_cart["Shopping Cart<br/>[shopping_cart.py]"]
end

node_learner(("Learner"))
node_pytest["Pytest Runner"]
node_weather_api["Weather API"]

node_learner -->|"runs lessons"| node_pytest
node_pytest -->|"runs tests"| node_basics_tests
node_pytest -->|"runs tests"| node_fixture_tests
node_pytest -->|"runs tests"| node_validator_tests
node_pytest -->|"runs tests"| node_weather_tests
node_pytest -->|"runs tests"| node_cart_tests
node_basics_tests -->|"tests"| node_calculator
node_fixture_tests -->|"exercises fixtures"| node_fixture_setup
node_fixture_setup -->|"creates"| node_user_db
node_validator_tests -->|"tests"| node_validator
node_weather_tests -->|"exercises mocking"| node_weather_advice
node_weather_advice -->|"fetches weather"| node_weather_api
node_weather_tests -->|"isolates dependency"| node_weather_api
node_cart_tests -->|"challenges"| node_shopping_cart
node_weather_advice -->|"gets temperature"| node_weather_advice

click node_basics_tests "https://github.com/opula1234/learn_pytest/blob/main/01_basics/test_calculator.py"
click node_calculator "https://github.com/opula1234/learn_pytest/blob/main/01_basics/calculator.py"
click node_fixture_tests "https://github.com/opula1234/learn_pytest/blob/main/02_fixtures/test_fixtures.py"
click node_fixture_setup "https://github.com/opula1234/learn_pytest/blob/main/02_fixtures/conftest.py"
click node_user_db "https://github.com/opula1234/learn_pytest/blob/main/02_fixtures/db.py"
click node_validator_tests "https://github.com/opula1234/learn_pytest/blob/main/03_parametrize/test_validator.py"
click node_validator "https://github.com/opula1234/learn_pytest/blob/main/03_parametrize/validator.py"
click node_weather_tests "https://github.com/opula1234/learn_pytest/blob/main/04_mocking/test_weather.py"
click node_weather_advice "https://github.com/opula1234/learn_pytest/blob/main/04_mocking/weather_service.py"
click node_cart_tests "https://github.com/opula1234/learn_pytest/blob/main/05_challenges/test_shopping_cart.py"
click node_shopping_cart "https://github.com/opula1234/learn_pytest/blob/main/05_challenges/shopping_cart.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_basics_tests,node_calculator toneBlue
class node_fixture_tests,node_fixture_setup,node_user_db,node_validator_tests,node_validator toneAmber
class node_weather_tests,node_weather_advice,node_cart_tests,node_shopping_cart,node_weather_api toneMint
class node_learner,node_pytest toneIndigo
```

## Components

### Core Testing

- [Basics Tests](https://github.com/opula1234/learn_pytest/blob/main/01_basics/test_calculator.py): `01_basics/test_calculator.py`
- [Calculator](https://github.com/opula1234/learn_pytest/blob/main/01_basics/calculator.py): `01_basics/calculator.py`

### Pytest Patterns

- [Fixture Tests](https://github.com/opula1234/learn_pytest/blob/main/02_fixtures/test_fixtures.py): `02_fixtures/test_fixtures.py`
- [Fixture Setup](https://github.com/opula1234/learn_pytest/blob/main/02_fixtures/conftest.py): `02_fixtures/conftest.py`
- [Mock User Database](https://github.com/opula1234/learn_pytest/blob/main/02_fixtures/db.py): `02_fixtures/db.py`
- [Validation Tests](https://github.com/opula1234/learn_pytest/blob/main/03_parametrize/test_validator.py): `03_parametrize/test_validator.py`
- [Input Validator](https://github.com/opula1234/learn_pytest/blob/main/03_parametrize/validator.py): `03_parametrize/validator.py`

### Applied Exercises

- [Mocking Tests](https://github.com/opula1234/learn_pytest/blob/main/04_mocking/test_weather.py): `04_mocking/test_weather.py`
- [Weather Advice](https://github.com/opula1234/learn_pytest/blob/main/04_mocking/weather_service.py): `04_mocking/weather_service.py`
- [Cart Challenge Tests](https://github.com/opula1234/learn_pytest/blob/main/05_challenges/test_shopping_cart.py): `05_challenges/test_shopping_cart.py`
- [Shopping Cart](https://github.com/opula1234/learn_pytest/blob/main/05_challenges/shopping_cart.py): `05_challenges/shopping_cart.py`

### Other components

- **Learner**
- **Pytest Runner**
- **Weather API**

## Connections

- Learner → Pytest Runner: runs lessons (evidence: `README.md`)
- Pytest Runner → Basics Tests: runs tests (evidence: `README.md`)
- Pytest Runner → Fixture Tests: runs tests (evidence: `README.md`)
- Pytest Runner → Validation Tests: runs tests (evidence: `README.md`)
- Pytest Runner → Mocking Tests: runs tests (evidence: `README.md`)
- Pytest Runner → Cart Challenge Tests: runs tests (evidence: `README.md`)
- Basics Tests → Calculator: tests (evidence: `README.md`)
- Fixture Tests → Fixture Setup: exercises fixtures (evidence: `README.md`)
- Fixture Setup → Mock User Database: creates (evidence: `02_fixtures/conftest.py`)
- Validation Tests → Input Validator: tests (evidence: `README.md`)
- Mocking Tests → Weather Advice: exercises mocking (evidence: `README.md`)
- Weather Advice → Weather API: fetches weather (evidence: `04_mocking/weather_service.py`)
- Mocking Tests → Weather API: isolates dependency (evidence: `README.md`)
- Cart Challenge Tests → Shopping Cart: challenges (evidence: `README.md`)
- Weather Advice → Weather Advice: gets temperature (evidence: `04_mocking/weather_service.py`)
