My FeedDiscussionsHashnode Enterprise
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

What's your way of managing fake data when testing Python

John Wu's photo
John Wu
·Oct 13, 2016

In python test we always need to create some fake data or mock subjects with unittest.mock. As the codebase grows bigger we might have thousands of those fake data so it becomes hard to manage. More specifically:

  1. Hard to locate when you need to reuse
  2. Hard to update when the original data structure changes

What's your way of maintaining them in tests?