Brian Okken

Coding with Tests and Automation

pytest Primary Power Course Is Ready

Everything you need to get started with pytest and use it effectively. Learn about: Test Functions Structure functions effectively Fixtures setup, teardown, and so much more Builtin Fixtures many common testing tasks are pre-built and ready to use Parametrization turn one test into many test cases Markers Builtin markers provided by pytest Custom markers for test selection Combining markers and fixtures to alter pytest behavior Available now Grab pytest Primary Power now, and start testing more effectively today....

September 12, 2023 · 1 min

pytest Course

Introducing the “Python Testing with pytest” Course Bundle. This is a video course series based on “Python Testing with pytest, 2nd edition”. It’s currently in an early “Pre-Release Beta” stage. There’s a video describing what that means. Basically, the bundle includes all courses in the series, available as he videos get completed, and includes a private discussion group and repo. See pytest courses for more info. Or simply head over to Welcome to the Pre-Release Beta to watch the welcome video, or to Python Testing with Pytest Course Bundle to grab it....

August 21, 2023 · 1 min · Brian

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 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. This talk describes how easy it is to share fixtures using the pytest plugin model....

March 19, 2023 · 1 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