<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Pytest on AI VOID</title><link>https://ai-blog.noorshomelab.dev/tags/pytest/</link><description>Recent content in Pytest on AI VOID</description><generator>Hugo</generator><language>en</language><lastBuildDate>Sat, 23 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://ai-blog.noorshomelab.dev/tags/pytest/index.xml" rel="self" type="application/rss+xml"/><item><title>Robust Testing for Long-Running Agent Workflows</title><link>https://ai-blog.noorshomelab.dev/adk-persistent-agents-2026/testing-long-running-agents/</link><pubDate>Sat, 23 May 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/adk-persistent-agents-2026/testing-long-running-agents/</guid><description>&lt;p&gt;Building a reliable, long-running AI agent that can pause, resume, and maintain its conversational context across sessions is paramount for production systems. This chapter focuses on establishing a robust testing framework to ensure our Google ADK agent&amp;rsquo;s state persistence and recovery mechanisms function flawlessly under various conditions.&lt;/p&gt;
&lt;p&gt;By the end of this milestone, you will have implemented unit, integration, and end-to-end tests. These tests will validate the agent&amp;rsquo;s ability to save and load its state, preserve conversation history, and correctly resume complex workflows after an interruption. This rigorous testing is crucial for delivering an AI agent that users can trust not to &amp;ldquo;forget&amp;rdquo; their interactions.&lt;/p&gt;</description></item><item><title>8. Test Lifecycle Management and Hooks</title><link>https://ai-blog.noorshomelab.dev/testcontainers-mastery-2026/08-test-lifecycle-management/</link><pubDate>Sat, 14 Feb 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/testcontainers-mastery-2026/08-test-lifecycle-management/</guid><description>&lt;h2 id="introduction-to-test-lifecycle-management"&gt;Introduction to Test Lifecycle Management&lt;/h2&gt;
&lt;p&gt;Welcome back, fellow explorers of robust testing! In previous chapters, we learned the magic of spinning up disposable containers to test our applications with real dependencies. We&amp;rsquo;ve seen how Testcontainers simplifies setting up databases like PostgreSQL and message brokers like Kafka, freeing us from the shackles of mocks and in-memory fakes.&lt;/p&gt;
&lt;p&gt;But here&amp;rsquo;s a thought: What happens to these containers after our tests run? And what if starting a new container for &lt;em&gt;every single test method&lt;/em&gt; slows down our test suite to a crawl? This is where Testcontainers&amp;rsquo; lifecycle management truly shines.&lt;/p&gt;</description></item><item><title>16. Project: Data Pipeline Testing with Python (Kafka &amp;amp; DB)</title><link>https://ai-blog.noorshomelab.dev/testcontainers-mastery-2026/16-project-data-pipeline-python/</link><pubDate>Sat, 14 Feb 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/testcontainers-mastery-2026/16-project-data-pipeline-python/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Welcome back, intrepid tester! So far, we&amp;rsquo;ve explored the foundational concepts of Testcontainers and used them to test single-service applications in various languages. But what about testing more complex systems, like the beating heart of many modern applications: a data pipeline?&lt;/p&gt;
&lt;p&gt;In this chapter, we&amp;rsquo;re going to tackle a real-world scenario: building and testing a simplified data pipeline in Python. This pipeline will involve two crucial external services: Apache Kafka for message queuing and PostgreSQL for data storage. Testing such a system traditionally is a headache, requiring manual setup of these services, which leads to flaky, slow, and inconsistent tests. Thankfully, Testcontainers comes to our rescue! We&amp;rsquo;ll use &lt;code&gt;testcontainers-python&lt;/code&gt; to spin up fresh, isolated instances of both Kafka and PostgreSQL for every test run, ensuring your tests are reliable and fast.&lt;/p&gt;</description></item><item><title>4. Core API: Generic Containers and Specific Modules</title><link>https://ai-blog.noorshomelab.dev/testcontainers-mastery-2026/04-core-api-generic-specific-modules/</link><pubDate>Sat, 14 Feb 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/testcontainers-mastery-2026/04-core-api-generic-specific-modules/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Welcome back, intrepid developer! In our previous chapters, we learned &lt;em&gt;why&lt;/em&gt; Testcontainers is a game-changer for robust, reliable integration and end-to-end testing. We understood how it leverages Docker to provide disposable, real-world dependencies without the headaches of managing complex test environments or falling into the trap of unreliable mocks.&lt;/p&gt;
&lt;p&gt;Now, it&amp;rsquo;s time to roll up our sleeves and explore the &lt;em&gt;how&lt;/em&gt;. This chapter dives deep into the heart of Testcontainers: its Core API. We&amp;rsquo;ll uncover two powerful ways to interact with Docker containers for your tests: using &lt;code&gt;GenericContainer&lt;/code&gt; for ultimate flexibility with any Docker image, and leveraging specialized &amp;ldquo;Modules&amp;rdquo; that offer convenient, idiomatic APIs for common services like databases and message brokers. By the end, you&amp;rsquo;ll be confidently spinning up and managing containerized services across Java, JavaScript, and Python.&lt;/p&gt;</description></item><item><title>Testing Your Code with `unittest` and `pytest`</title><link>https://ai-blog.noorshomelab.dev/python-mastery-2025/chapter-19-testing-your-code-unittest-pytest/</link><pubDate>Wed, 03 Dec 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/python-mastery-2025/chapter-19-testing-your-code-unittest-pytest/</guid><description>&lt;h2 id="introduction-to-testing-your-code"&gt;Introduction to Testing Your Code&lt;/h2&gt;
&lt;p&gt;Welcome back, future Pythonista! So far, you&amp;rsquo;ve learned to write amazing Python code, build functions, create classes, and even handle errors. But how do you &lt;em&gt;know&lt;/em&gt; your code actually works as intended, especially as it grows more complex? How do you ensure that adding a new feature doesn&amp;rsquo;t accidentally break an old one?&lt;/p&gt;
&lt;p&gt;The answer, my friend, is &lt;strong&gt;testing&lt;/strong&gt;! In this chapter, we&amp;rsquo;re going to dive into the incredibly important world of unit testing in Python. You&amp;rsquo;ll learn how to write small, focused tests for individual pieces of your code, giving you confidence that your programs are robust and reliable. We&amp;rsquo;ll explore Python&amp;rsquo;s built-in testing framework, &lt;code&gt;unittest&lt;/code&gt;, and then introduce you to &lt;code&gt;pytest&lt;/code&gt;, a hugely popular and powerful third-party testing tool that many developers prefer.&lt;/p&gt;</description></item></channel></rss>