HomeRoadmapsPyTest & SQL AI QE Day 1
Python, PyTest & SQL Foundations for AI QE Β· Day 1 Β· 20 min

PyTest Architecture, AI Markers & JUnit
Python, PyTest & SQL Foundations for AI QE β€” Day 1

Design a production PyTest evaluation harness with shared conftest.py fixtures, strict custom markers (@pytest.mark.probabilistic, @pytest.mark.safety, @pytest.mark.sql), a structured EvalCollector, and JUnit XML exports.

⚑ Runtime: Python 3.10+ Β· PyTest Β· Built-in SQLite3πŸ§ͺ Python & SQL AI QE Engineer
PyTestFixturesCustom MarkersEvalCollectorJUnit XML
About this lab

Ad-hoc Python scripts fail to scale when regulated financial and consumer AI assistants need fast PR feedback and auditable CI evidence. Today you will structure a reusable PyTest suite with--strict-markers, shared conftest.py fixtures, a structuredEvalCollector, and machine-readable JUnit XML reporting.

πŸ“¦Sample Codebase & Working Solution (Day 1)Available Now
View on GitHub

The official reference codebase for Day 1 is hosted in the repository. Clone the repository and navigate to day-1-pytest-architecture/test_day1_architecture.py to run the working solution.

Git Clone β€” Working Solution
git clone https://github.com/777abhi/pytest-sql-ai-qe-roadmap.git
cd pytest-sql-ai-qe-roadmap/day-1-pytest-architecture/test_day1_architecture.py
🏭Production Context & Enterprise Implementation
πŸ’‘ Why We Are Doing This: Separating deterministic API/SQL checks from probabilistic and safety tests lets CI pipelines run targeted suites (e.g. pytest -m safety) on every pull request while publishing standardized JUnit XML to Azure DevOps and GitHub Actions.
🏒 Real-World Production Usecase: Baseline test architecture for regulated customer support Q&A, policy lookup, and claims-triage AI services.
βš™οΈ How Implemented in Production: pytest.ini registers custom markers with --strict-markers; conftest.py injects EvalCollector and SQLite3 fixtures; EvalCollector exports both JSON summaries and JUnit XML.
Phase 1

Run & Inspect PyTest Architecture & Custom Markers

Clone the offline companion repository, install PyTest, and run the Day 1 test suite.

Step 1.1: Clone, Install PyTest & Run Day 1
Terminal β€” Setup Day 1 Lab
git clone https://github.com/777abhi/pytest-sql-ai-qe-roadmap.git
cd pytest-sql-ai-qe-roadmap
pip install -r requirements.txt
npm run test:day1
Step 1.2: Filter Suites with Custom AI Markers
Terminal β€” Marker Filtering & JUnit Export
python3 -m pytest -m safety day-1-pytest-architecture
python3 -m pytest day-1-pytest-architecture --junitxml=artifacts/junit-day1.xml
Day 1 Key Learnings
  • Configured pytest.ini with --strict-markers to prevent silent marker typos in CI pipelines.
  • Built reusable conftest.py fixtures for structured evaluation collection and isolated test state.
  • Exported per-case AI evaluation scores and failure reasons to JSON and CI-ready JUnit XML.

🧠 Knowledge Check

Why should AI QE teams enable --strict-markers in pytest.ini and separate tests with markers like @pytest.mark.safety and @pytest.mark.probabilistic?