Test & Code cover image

Test & Code

Latest episodes

undefined
Dec 17, 2021 • 24min

173: Why NOT unittest?

In the preface of "Python Testing with pytest" I list some reasons to use pytest, under a section called "why pytest?". Someone asked me recently, a different but related question "why NOT unittest?".unittest is an xUnit style framework. For me, xUnit style frameworks are fatally flawed for software testing.That's what this episode is about, my opinion of "Why NOT unittest?", or more broadly, "What are the fatal flaws of xUnit?"Links:Python Testing with pytest, Second Editionunittest docsunittest assert methodsxUnit - Wikipedia Help support the show AND learn pytest: The Complete pytest course is now a bundle, with each part available separately.pytest Primary Power teaches the super powers of pytest that you need to learn to use pytest effectively.Using pytest with Projects has lots of "when you need it" sections like debugging failed tests, mocking, testing strategy, and CIThen pytest Booster Rockets can help with advanced parametrization and building plugins.Whether you need to get started with pytest today, or want to power up your pytest skills, PythonTest has a course for you. ★ Support this podcast on Patreon ★
undefined
Nov 30, 2021 • 7min

172: Designing Better Software with a Prototype Mindset

A prototype is a a preliminary model of something, from which other forms are developed or copied. In software, we think of prototypes as early things, or a proof of concept. We don't often think of prototyping during daily software development or maintenance. I think we should. This episode is about growing better designed software with the help of a prototype mindset.Links:Selecting a programming language can be a form of premature optimization — Brett Cannon's blog post Help support the show AND learn pytest: The Complete pytest course is now a bundle, with each part available separately.pytest Primary Power teaches the super powers of pytest that you need to learn to use pytest effectively.Using pytest with Projects has lots of "when you need it" sections like debugging failed tests, mocking, testing strategy, and CIThen pytest Booster Rockets can help with advanced parametrization and building plugins.Whether you need to get started with pytest today, or want to power up your pytest skills, PythonTest has a course for you. ★ Support this podcast on Patreon ★
undefined
Nov 22, 2021 • 39min

171: How and why I use pytest's xfail - Paul Ganssle

Paul Ganssle, is a software developer at Google, core Python dev, and open source maintainer for many projects, has some thoughts about pytest's xfail. He was an early skeptic of using xfail, and is now an proponent of the feature. In this episode, we talk about some open source workflows that are possible because of xfail. Special Guest: Paul Ganssle.Links:How and why I use pytest's xfail — Paul's blog post mentioned in the episodeCraft Minimal Bug Reports — Matthew Rocklin's articleepisode 111: Subtests in Python with unittest and pytest - Paul Ganssleepisode 165: pytest xfail policy and workflowepisode 166: unittest expectedFailure and xfail Help support the show AND learn pytest: The Complete pytest course is now a bundle, with each part available separately.pytest Primary Power teaches the super powers of pytest that you need to learn to use pytest effectively.Using pytest with Projects has lots of "when you need it" sections like debugging failed tests, mocking, testing strategy, and CIThen pytest Booster Rockets can help with advanced parametrization and building plugins.Whether you need to get started with pytest today, or want to power up your pytest skills, PythonTest has a course for you. ★ Support this podcast on Patreon ★
undefined
4 snips
Nov 18, 2021 • 46min

170: pytest for Data Science and Machine Learning - Prayson Daniel

Prayson Daniel, a principle data scientist, discusses testing machine learning pipelines with pytest.Prayson is using pytest for some pretty cool stuff, including:unit tests, of coursetesting pipeline stagescounterfactual testingperformance testingAll with pytest. So cool.Special Guest: Prayson Daniel.Links:Python Bytes 250, with Prayson Daniel — Listen to this for more of an introduction to Prayson Help support the show AND learn pytest: The Complete pytest course is now a bundle, with each part available separately.pytest Primary Power teaches the super powers of pytest that you need to learn to use pytest effectively.Using pytest with Projects has lots of "when you need it" sections like debugging failed tests, mocking, testing strategy, and CIThen pytest Booster Rockets can help with advanced parametrization and building plugins.Whether you need to get started with pytest today, or want to power up your pytest skills, PythonTest has a course for you. ★ Support this podcast on Patreon ★
undefined
Nov 11, 2021 • 31min

169: Service and Microservice Performance Monitoring - Omri Sass

Performance monitoring and error detection is just as important with services and microservices as with any system, but with added complexity. Omri Sass joins the show to explain telemetry and monitoring of services and of systems with services. Special Guest: Omri Sass. Help support the show AND learn pytest: The Complete pytest course is now a bundle, with each part available separately.pytest Primary Power teaches the super powers of pytest that you need to learn to use pytest effectively.Using pytest with Projects has lots of "when you need it" sections like debugging failed tests, mocking, testing strategy, and CIThen pytest Booster Rockets can help with advanced parametrization and building plugins.Whether you need to get started with pytest today, or want to power up your pytest skills, PythonTest has a course for you. ★ Support this podcast on Patreon ★
undefined
Nov 2, 2021 • 12min

168: Understanding Complex Code by Refactoring into Larger Functions

To understand complex code, it can be helpful to remove abstractions, even if it results in larger functions. This episode walks through a process I use to refactor code that I need to debug and fix, but don't completely understand. Help support the show AND learn pytest: The Complete pytest course is now a bundle, with each part available separately.pytest Primary Power teaches the super powers of pytest that you need to learn to use pytest effectively.Using pytest with Projects has lots of "when you need it" sections like debugging failed tests, mocking, testing strategy, and CIThen pytest Booster Rockets can help with advanced parametrization and building plugins.Whether you need to get started with pytest today, or want to power up your pytest skills, PythonTest has a course for you. ★ Support this podcast on Patreon ★
undefined
Oct 22, 2021 • 38min

167: React, TypeScript, and the Joy of Testing - Paul Everitt

Paul has a tutorial on testing and TDD with React and TypeScript.  We discuss workflow and the differences, similarities between testing with React/TypeScript and Python. We also discuss what lessons that we can bring from front end testing to Python testing.Special Guest: Paul Everitt.Links:React, TypeScript, and TDD — Paul Everitt's tutorialReact Testing Library Help support the show AND learn pytest: The Complete pytest course is now a bundle, with each part available separately.pytest Primary Power teaches the super powers of pytest that you need to learn to use pytest effectively.Using pytest with Projects has lots of "when you need it" sections like debugging failed tests, mocking, testing strategy, and CIThen pytest Booster Rockets can help with advanced parametrization and building plugins.Whether you need to get started with pytest today, or want to power up your pytest skills, PythonTest has a course for you. ★ Support this podcast on Patreon ★
undefined
Oct 14, 2021 • 7min

166: unittest expectedFailure and xfail

xfail isn't just for pytest tests. Python's unittest has @unittest.expectedFailure.In this episode, we cover:using @unittest.expectedFailurethe results of passing and failing tests with expectedFailureusing pytest as a test runner for unittestusing pytest markers on unittest testsDocs for expectedFailure:  https://docs.python.org/3/library/unittest.html#skipping-tests-and-expected-failuresSome sample code.  unittest only:import unittest class ExpectedFailureTestCase(unittest.TestCase): @unittest.expectedFailure def test_fail(self): self.assertEqual(1, 0, "broken") @unittest.expectedFailure def test_pass(self): self.assertEqual(1, 1, "not broken") unittest with pytest markers:import unittest import pytest class ExpectedFailureTestCase(unittest.TestCase): @pytest.mark.xfail def test_fail(self): self.assertEqual(1, 0, "broken") @pytest.mark.xfail def test_pass(self): self.assertEqual(1, 1, "not broken") Help support the show AND learn pytest: The Complete pytest course is now a bundle, with each part available separately.pytest Primary Power teaches the super powers of pytest that you need to learn to use pytest effectively.Using pytest with Projects has lots of "when you need it" sections like debugging failed tests, mocking, testing strategy, and CIThen pytest Booster Rockets can help with advanced parametrization and building plugins.Whether you need to get started with pytest today, or want to power up your pytest skills, PythonTest has a course for you. ★ Support this podcast on Patreon ★
undefined
Oct 7, 2021 • 10min

165: pytest xfail policy and workflow

A discussion of how to use the xfail feature of pytest to help with communication on software projects.The episode covers:What is xfailWhy I use itUsing reason effectively by including issue tracking numbersUsing xfail_strictAdding --runxfail when transitioning from development to feature freezeWhat to do about test failuresHow all of this might help with team communication Help support the show AND learn pytest: The Complete pytest course is now a bundle, with each part available separately.pytest Primary Power teaches the super powers of pytest that you need to learn to use pytest effectively.Using pytest with Projects has lots of "when you need it" sections like debugging failed tests, mocking, testing strategy, and CIThen pytest Booster Rockets can help with advanced parametrization and building plugins.Whether you need to get started with pytest today, or want to power up your pytest skills, PythonTest has a course for you. ★ Support this podcast on Patreon ★
undefined
Sep 14, 2021 • 13min

164: Debugging Python Test Failures with pytest

An overview of the pytest flags that help with debugging. From Chapter 13, Debugging Test Failures, of Python Testing with pytest, 2nd edition.pytest includes quite a few command-line flags that are useful for debugging. We talk about thes flags in this episode.Flags for selecting which tests to run, in which order, and when to stop:-lf / --last-failed: Runs just the tests that failed last.-ff / --failed-failed: Runs all the tests, starting with the last failed.-x / --exitfirst: Stops the tests session afterEd: after?Author: yep the first failure.--maxfail=num: Stops the tests after num failures.-nf / --new-first: Runs all the tests, ordered by file modification time.--sw / --stepwise: Stops the tests at the first failure. Starts the tests at the last failure next time.--sw-skip / --stepwise-skip: Same as --sw, but skips the first failure.Flags to control pytest output:-v / --verbose Displays all the test names, passing or failing.--tb=[auto/long/short/line/native/no] Controls the traceback style.-l / --showlocals Displays local variables alongside the stacktrace.Flags to start a command-line debugger:--pdb Starts an interactive debugging session at the point of failure.--trace Starts the pdb source-code debugger immediately when running each test.--pdbcls Uses alternatives to pdb, such as IPython’s debugger with –-pdbcls=IPython.terminal.debugger:TerminalPdb.This list is also found in Chapter 13 of Python Testing with pytest, 2nd edition. The chapter is "Debugging Test Failures" and covers way more than just debug flags, while walking through debugging 2 test failures.Links:Python Testing with pytest — The fastest way to get up to speed on pytest.all pytest flags in pytest 6.2.x Help support the show AND learn pytest: The Complete pytest course is now a bundle, with each part available separately.pytest Primary Power teaches the super powers of pytest that you need to learn to use pytest effectively.Using pytest with Projects has lots of "when you need it" sections like debugging failed tests, mocking, testing strategy, and CIThen pytest Booster Rockets can help with advanced parametrization and building plugins.Whether you need to get started with pytest today, or want to power up your pytest skills, PythonTest has a course for you. ★ Support this podcast on Patreon ★

The AI-powered Podcast Player

Save insights by tapping your headphones, chat with episodes, discover the best highlights - and more!
App store bannerPlay store banner
Get the app