Brian Okken

Developing Software with Tests

Sharing is Caring - Sharing pytest Fixtures - PyCascades 2023

Slides and code and such for a talk for PyCascades 2023. Talk page: Sharing is Caring - Sharing pytest Fixtures Scheduled Time: Sunday, March 19, 11:30 am Summary: pytest rocks, obviously. When people start using pytest as a team, they often come up with cool fixtures that would be great to share across projects. In fact, many great Python packages come pre-loaded with pytest fixtures....

March 19, 2023 · 1 min · Brian

Test & Code Returns

Did I get the title right? I’m not sure. Maybe I should have replaced “returns” with reimagined, revisited, continued, expanded, focused, or something even more descriptive that could help me with direction as I keep producing more episodes of this thing. This post is a reflection of why I stopped in August 2022. I’d like to also talk about where the podcast is going in the future. But I’m not really sure....

March 5, 2023 · 4 min · Brian

pytest tips and tricks

This is a set of tips/tricks for learning and using pytest. I’ll probably build on the list, so feel free to share with me items you think should be in the list. Many items really deserve more explanation, and maybe full posts. Let me know if there’s something you’d like more in depth discussion of. Note: I’m not numbering these, because I don’t want to keep track of order. Also, this is more of a brain dump, and not a prioritized list....

February 27, 2023 · 6 min · Brian

Fixing Circular Imports in Python with Protocol

The problem started when I had two classes that needed to talk to each other. Sometimes, classes need to talk to each other in both directions. The following example is made up, but mostly behaves like the original problem. Let’s say I have a Director and an Actor. The Director tells the Actor to do_action(). In order to do the action, the Actor needs to get_data() from the Director. Here’s our director....

January 23, 2023 · 4 min · Brian

Testing with Python 3.12

Python 3.12.0a2 is out. So now may be a great time to get your projects to start testing against 3.12. Note about alpha releases of Python This is from the same link as above: “During the alpha phase, features may be added up until the start of the beta phase (2023-05-08) and, if necessary, may be modified or deleted up until the release candidate phase (2023-07-31). Please keep in mind that this is a preview release and its use is not recommended for production environments....

December 5, 2022 · 3 min · Brian

Installing Python 3.11 on Mac or Windows

Installing Python from The easiest and most obvious (to me) way to install the latest version of Python on either Mac or Windows is: Go to Hover over the “Downloads” link in the navigation. This will detect if you are on Mac or Windows and present you with a button called “Python 3.11.0” (or whatever the latest version is). Click that button. This downloads an installer. Run the installer....

October 26, 2022 · 4 min

Talk - Sharing is Caring - pytest fixture edition

Sharing is Caring, pytest fixture edition I gave a talk at PyBay 2022 with the above title. It’s about sharing fixtures. The source code, and the slides, are at

September 10, 2022 · 1 min · Brian

Current Git CLI workflow

Workflow Most of my interactions with git CLI, especially for quick changes, is: $ git checkout main $ git pull $ git checkout -b okken_something < code changes > $ git commit -a -m 'quick message' $ git push Then the code review and merge happen on the server. Commands Let’s break that down. git checkout main Start at the main branch. git pull Grab any changes from remote repo....

April 13, 2022 · 2 min · Brian

Lean TDD

Preface Lean TDD is an attempt to reconcile some conflicting aspects of Test Driven Development and Lean Software Development. I’ve mentioned Lean TDD on the podcast a few times and even tried to do a quick outline at the end of episode 162. This post is a more complete outline, or at least a first draft. In audio form The initial version of this post is also available in audio form as Test & Code, episode 180....

February 20, 2022 · 17 min · Brian

Beta 9.0 of Python Testing with pytest, 2nd ed, available.

The Beta 9.0 is available for Python Testing with pytest, 2nd edition, as of Feb 9, 2022. With this 9th beta release, copy edit and indexing are complete. Next it goes to layout, then to printing. Amazon has it for pre-order, listing March 22 as availability. I think we should be able to hit that. I’m excited.

February 11, 2022 · 1 min · Brian