Artwork

Contenuto fornito da Real Python. Tutti i contenuti dei podcast, inclusi episodi, grafica e descrizioni dei podcast, vengono caricati e forniti direttamente da Real Python o dal partner della piattaforma podcast. Se ritieni che qualcuno stia utilizzando la tua opera protetta da copyright senza la tua autorizzazione, puoi seguire la procedura descritta qui https://it.player.fm/legal.
Player FM - App Podcast
Vai offline con l'app Player FM !

Eric Matthes: Maybe Don't Start With Unit Tests

1:10:48
 
Condividi
 

Manage episode 470148880 series 2637014
Contenuto fornito da Real Python. Tutti i contenuti dei podcast, inclusi episodi, grafica e descrizioni dei podcast, vengono caricati e forniti direttamente da Real Python o dal partner della piattaforma podcast. Se ritieni che qualcuno stia utilizzando la tua opera protetta da copyright senza la tua autorizzazione, puoi seguire la procedura descritta qui https://it.player.fm/legal.

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.

Course Spotlight: Using Python’s assert to Debug and Test Your Code

In this course, you’ll learn how to use Python’s assert statement to document, debug, and test code in development. You’ll learn how assertions might be disabled in production code, so you shouldn’t use them to validate data. You’ll also learn about a few common pitfalls of assertions in Python.

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 our expert-led courses:

Support the podcast & join our community of Pythonistas

  continue reading

246 episodi

Artwork
iconCondividi
 
Manage episode 470148880 series 2637014
Contenuto fornito da Real Python. Tutti i contenuti dei podcast, inclusi episodi, grafica e descrizioni dei podcast, vengono caricati e forniti direttamente da Real Python o dal partner della piattaforma podcast. Se ritieni che qualcuno stia utilizzando la tua opera protetta da copyright senza la tua autorizzazione, puoi seguire la procedura descritta qui https://it.player.fm/legal.

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.

Course Spotlight: Using Python’s assert to Debug and Test Your Code

In this course, you’ll learn how to use Python’s assert statement to document, debug, and test code in development. You’ll learn how assertions might be disabled in production code, so you shouldn’t use them to validate data. You’ll also learn about a few common pitfalls of assertions in Python.

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 our expert-led courses:

Support the podcast & join our community of Pythonistas

  continue reading

246 episodi

Tutti gli episodi

×
 
Loading …

Benvenuto su Player FM!

Player FM ricerca sul web podcast di alta qualità che tu possa goderti adesso. È la migliore app di podcast e funziona su Android, iPhone e web. Registrati per sincronizzare le iscrizioni su tutti i tuoi dispositivi.

 

Guida rapida

Ascolta questo spettacolo mentre esplori
Riproduci