Maybe Don’t Start With Unit Tests – The Real Python Podcast


Real Python Podcast E242 Title Image

Mar 07, 2025 1h 10m

Christopher Bailey
Eric Matthes

Should you always start testing your code with unit tests? When does it make sense to look at integration or end-to-end testing as a first step instead? This week on the show, we speak with previous guest Eric Matthes about where to begin testing your code.

Eric is the author of the popular book Python Crash Course. Early in the development of the book, he decided to introduce testing and added a chapter on testing code with pytest.

Over the past couple of years, Eric has continued to consider when and where to test a project’s code. He thinks there are hazards to always starting with unit tests. The type of project and its audience should determine what kind of testing to employ initially.

We discuss using pytest to develop integration tests on multiple types of projects. We also explore fixtures and what goes into building a test suite. Eric also shares criteria for when and where it makes sense to add unit tests to a project.

Topics:

  • 00:00:00 – Introduction
  • 00:01:47 – Submitting talks to conferences
  • 00:04:10 – Don’t start with unit tests!
  • 00:07:35 – How did you start with testing?
  • 00:11:30 – Example of a project needing tests
  • 00:14:54 – Defining types of tests
  • 00:16:44 – Integration vs end-to-end tests
  • 00:19:09 – When should you build tests?
  • 00:22:13 – Trade offs of integration vs unit tests
  • 00:24:05 – Why is there push back on this idea?
  • 00:27:36 – Video Course Spotlight
  • 00:29:09 – Using pytest
  • 00:33:24 – Transcripts project example
  • 00:37:03 – py-image-border project
  • 00:40:29 – Criteria for when you should write unit tests
  • 00:48:51 – How to practice writing tests
  • 00:50:28 – Building an integration test and pytest fixtures
  • 00:55:05 – What’s in the test folder?
  • 00:56:31 – Idea for a PyCon tutorial on implementing tests
  • 00:57:29 – Other pytest advice and parametrization
  • 01:01:13 – Caveats to not starting with unit tests
  • 01:02:30 – pytest documentation and other advice
  • 01:05:23 – How to reach Eric online
  • 01:06:47 – What are you excited about in the world of Python?
  • 01:08:23 – What do you want to learn next?
  • 01:09:48 – What conferences are you attending?
  • 01:10:06 – Thanks and goodbye

Show Links:

Level Up Your Python Skills With These Courses:





Source link

Related Posts

About The Author

Add Comment