Exploring the Intersection of Technology, Adventure, and Innovation

Join me on a journey as a software developer hailing from Pakistan, as I share my experiences and insights into the exciting world of web app development, data engineering, MLOps, and DevOps. Along the way, I'll also share my passion for adventure, from traveling on my motorbike to hiking in the mountains.

Mocking Imports in Python for Unit Testing: A Comprehensive Guide

This blog post provides a comprehensive guide on how to mock imports in Python for unit testing. It covers the use of sys.modules dictionary and MagicMock objects to replace real modules with mock objects, and provides examples for both pytest and unittest frameworks.