Skip to main content

4 posts tagged with "qa"

qa tag description

View All Tags

Postman clear cache response

· 7 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

While Postman doesn't have a single "Clear Cache" button that directly affects API results (as it doesn't cache external API responses), the core issue often lies in two areas that mimic caching: DNS resolution and request state persistence.

Python Mocking: The Ultimate Guide from Basics to Advanced Test Double Patterns

· 8 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

Unit tests must run in complete isolation from external resources like databases, networks, and file systems. Python's unittest.mock library is the standard tool for creating test doubles, enabling you to inspect invocations, mock complex class initializers, verify function signatures, and control time.

This guide provides a comprehensive manual on Python mocking, covering foundational concepts, interface enforcement via specs, stateful simulation, constructor patching, temporal mocking, and ecosystem integrations.

Pytest: Mocking Objects and Classes

· 9 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

Mocking entire classes and objects is a crucial skill for unit testing complex code. When a function instantiates a class or calls methods on a passed-in object, you need a way to control that object's behavior without executing its real logic. This article will cover advanced mocking techniques, focusing on how to mock classes and instance methods using both the standard unittest.mock library and the more convenient pytest-mock plugin. We will also clarify key distinctions between different types of test doubles.

Mock external dependencies in Python unittest

· 9 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

External dependencies are a major source of pain in unit testing. They can be slow, unreliable, and difficult to control. Mocking these external services is the single most common and valuable use of the unittest.mock library [1]. This article will provide practical, hands-on examples for mocking three of the most frequent external dependencies: HTTP requests, database connections, and file system operations.