MemotivaTesting in Python

What is mocking in tests?

Testing in Python

Audio flashcard · 0:17

Nortren·

What is mocking in tests?

0:17

Mocking is the practice of replacing real dependencies with controllable substitutes during a test. The unittest.mock module provides Mock and MagicMock classes and the patch context manager. Mocking lets you isolate the unit under test from databases, network services, and other slow or unreliable components.
docs.python.org