

Test & Code
Brian Okken
The Python Test Podcast hosted by Brian Okken
Episodes
Mentioned books

Oct 22, 2021 • 37min
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

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")

Oct 7, 2021 • 9min
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

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

Aug 20, 2021 • 29min
163: pip install ./local_directory - Stéphane Bidoul
pip : "pip installs packages" or maybe "Package Installer for Python" pip is an invaluable tool when developing with Python. A lot of people know pip as a way to install third party packages from pypi.org You can also use pip to install from other indexes (or is it indices?)You can also use pip to install a package in a local directory. That's the part I want to jump in and explore with Stéphane Bidoul. The way pip installs from a local directory is about to change, and the story is fascinating.Special Guest: Stéphane Bidoul.Links:The Odoo Community AssociationPEP 610 -- Recording the Direct URL Origin of installed distributions | Python.orgPEP 660 -- Editable installs for pyproject.toml based builds (wheel based) | Python.org — Bidoulpip install --no-index --find-links Solving issues related to out-of-tree builds · Issue #7555 · pypa/pippip list json format

Aug 3, 2021 • 22min
162: Flavors of TDD
What flavor of TDD do you practice? In this episode we talk about:Classical vs Mockist TDDDetroit vs London (I actually refer to it in the episode as Chicago instead of Detroit. Oh well.)Static vs BehaviorInside Out vs Outside InDouble Loop TDDBDDFDDTracer BulletsRules of TDDTeam StructureLean TDD This is definitely an episode I'd like feedback on. Reach out to me for further questions or if I missed some crucial variant of TDD that you know and love.Links:Mocks Aren't Stubs - Martin FowlerMockists Are Dead. Long Live Classicists.Double Loop TDDBDD: Behavior-driven developmentFDD: Feature-driven developmentMy reaction to “Is TDD Dead?” - pythontest.comTest First Programming / Test First DevelopmentHumorous list of TDD variants — BDD = Buzzword Driven Development, CDD = Calendar Driven Development, etc

Jul 20, 2021 • 18min
161: Waste in Software Development
Software development processes create value, and have waste, in the Lean sense of the word waste. Lean manufacturing and lean software development changed the way we look at value and waste. This episode looks at lean definitions of waste, so we can see it clearly when we encounter it.I'm going to use the term waste and value in future episodes. I'm using waste in a Lean sense, so we can look at software processes critically, see the value chain, and try to reduce waste.Lean manufacturing and lean software development caused people to talk about and examine waste and value, even in fields where we didn't really think about waste that much to begin with.Software is just ones and zeros. Is there waste? When I delete a file, nothing goes into the landfill.The mistake I'm making here is confusing the common English definition of waste when what we're talking about is the Lean definition of waste.This episode tries to clear up the confusion.Links:Big Design Up FrontLightweight MethodologiesManifesto for Agile Software DevelopmentExtreme programmingThe New MethodologyTest First Programming / Test First DevelopmentTest Driven DevelopmentThe Pragmatic ProgrammerSix SigmaDMAICLean software developmentLean manufacturingThe Toyota WayLean Six SigmaDefinition of Waste by Merriam-Webster

Jul 8, 2021 • 14min
160: DRY, WET, DAMP, AHA, and removing duplication from production code and test code
Should your code be DRY or DAMP or something completely different? How about your test code? Do different rules apply? Wait, what do all of these acronyms mean?We'll get to all of these definitions, and then talk about how it applies to both production code and test code in this episode. Links:The Pragmatic Programmer, 20th Anniversary EditionDon't repeat yourself - Wikipediaa-ha - Take On MeRule of three - WikipediaWhat does “DAMP not DRY” mean when talking about unit tests? - Stack Overflow

Jul 2, 2021 • 47min
159: Python, pandas, and Twitter Analytics - Matt Harrison
When learning data science and machine learning techniques, you need to work on a data set. Matt Harrison had a great idea: Why not use your own Twitter analytics data? So, he did that with his own data, and shares what he learned in this episode, including some of his secrets to gaining followers.In this episode we talk about:Looking at your own Twitter analytics data.Using Python, pandas, Jupyter for data cleaning and exploratory analysisData visualizationMachine learning, principal component analysis, clusteringModel drift and re-running analysisWhat kind of tweets perform wellAnd much moreLinks:Applied Pandas: Twitter Analytics — the course

Jun 18, 2021 • 43min
158: TDD in Swift - Gio Lodi
Iterative processes that include writing test code and production code together, such as TDD, help make coding fun. All of us that care about developing quality code with the help of testing can learn from each other, regardless of programming language.Today we step outside our normal Python comfort zone and talk with Gio about TDD in Swift.Gio Lodi, author of TDD in Swift, joins the show to discuss Test Driven Development, software workflows, bottom up vs top down, rapid feedback, developer vs customer facing tests, and more.Links:TDD in Swift with SwiftUI and Combinemokacoding - Gio's blogXCTestSoftware Design: Tidy First? - Kent Beck on Substack