Posts

Image for: Posts

A collection of 58 Posts

Unravelling t-strings with pytest

Image for: Unravelling t-strings with pytest

Brett Cannon recently released an article explaining Python 3.14's new t-strings. This article has pytest versions of the code from Brett's article.

Testing some tidbits with pytest

Image for: Testing some tidbits with pytest

I noticed a fun post by Ned Batchelder called "Testing some tidbits". The post looks at different ways to see if a string has only 0 or 1 in it. I'm expanding on that with some pytest code to test the different ways.

Finding the top pytest plugins

Image for: Finding the top pytest plugins

What are the top downloaded pytest plugins? I want to know this. And I'd like the answer updated regularly. So today I decided to write a script to do that for me.

pytest 8 is here

Image for: pytest 8 is here

A few notes on some cool additions in pytest 8

Testing argparse Applications

Image for: Testing argparse Applications

CLI testing can be tricky, we unravel it for argparse apps

pytest slow order

Image for: pytest slow order

Using pytest-skip-slow to control whether or not to run slow tests.

Upgrading to Python 3.12 and my battle with virtualenv cache

Image for: Upgrading to Python 3.12 and my battle with virtualenv cache

Recapping some troubles I had when upgrading

pytest Primary Power Course Is Ready

Image for: pytest Primary Power Course Is Ready

Announcing the new course

Sharing is Caring - Sharing pytest Fixtures - PyCascades 2023

Image for: Sharing is Caring - Sharing pytest Fixtures - PyCascades 2023

Slides, link to video, and resources

pytest tips and tricks

Image for: pytest tips and tricks

This is a set of tips/tricks for learning and using pytest.

Fixing Circular Imports in Python with Protocol

Image for: Fixing Circular Imports in Python with Protocol

Quick tutorial with example

Testing with Python 3.12

Image for: Testing with Python 3.12

Encouraging people to test

Installing Python 3.11 on Mac or Windows

Image for: Installing Python 3.11 on Mac or Windows

The easiest way to install Python 3.11

Talk - Sharing is Caring - pytest fixture edition

Image for: Talk - Sharing is Caring - pytest fixture edition

PyBay talk resources

Current Git CLI workflow

Image for: Current Git CLI workflow

Just documenting my git workflow

Lean TDD

Image for: Lean TDD

A discussion of some ideas around Lean TDD from 2022. 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][testandcode] a few times and even tried to do a quick outline at the end of [episode 162][flavors]. This post is a more complete outline, or at least a first draft.

Pinning Application Dependencies with pip-tools compile

Image for: Pinning Application Dependencies with pip-tools compile

Pinning dependencies

PythonBytes.fm

Image for: PythonBytes.fm

Announcing our new podcast

Python featured in April issue of PragPub

Image for: Python featured in April issue of PragPub

The first time I had something published

Given-When-Then

Image for: Given-When-Then

Designing your test cases/test methods using given-when-then.

pytest-expect code now in a github repo

Image for: pytest-expect code now in a github repo

I’ve made a few changes to the pytest-expect fixture plugin.

  1. I’ve put the plugin code on github, https://github.com/okken/pytest-expect.
  2. It is …

pytest expect fixture plugin, iteration 1

Image for: pytest expect fixture plugin, iteration 1

This is the first iteration that implements ’expect’ as a fixture.

This is really the third attempt at an ’expect()’ implementation that …

Test First Programming / Test First Development

Image for: Test First Programming / Test First Development

Occasionally referred to as Test First Development, Test First Programming is a beautiful concept that radically changed the way I approach software …

pytest delayed assert / multiple failure plugin, iteration 1

Image for: pytest delayed assert / multiple failure plugin, iteration 1

In Delayed assert / multiple failures per test, I presented a first attempt at writing an ’expect()’ function that will allow
a test function to …

Delayed assert / multiple failures per test

Image for: Delayed assert / multiple failures per test

A test stops execution once it hits a failing assert statement.
That’s kinda the point of an assert statement, though, so that’s not surprising. …

perspectives, opinions, dogma, and an elephant

Image for: perspectives, opinions, dogma, and an elephant

Sharing different perspectives

Why Most Unit Testing is Waste

Image for: Why Most Unit Testing is Waste

A re-publishing of James Coplien's article

My reaction to “Is TDD Dead?”

Image for: My reaction to “Is TDD Dead?”

Discussion around the future of TDD

How do I start testing?

Image for: How do I start testing?

An attemp to answer this age old question

pytest session scoped fixtures

Image for: pytest session scoped fixtures

Running through an example

pytest fixtures nuts and bolts

Image for: pytest fixtures nuts and bolts

fixtures reference

pytest fixtures easy example

Image for: pytest fixtures easy example

A walk though of fixtures with an example

pytest xUnit style fixtures

Image for: pytest xUnit style fixtures

Using xUnit style with pytest

pytest fixtures – part 1

Image for: pytest fixtures – part 1

An initial dive into fixtures

pytest full support of unittest fixtures in pytest 2.4

Image for: pytest full support of unittest fixtures in pytest 2.4

Yes. pytest handles unittest fixtures fine

The power of “Thank You”

Image for: The power of “Thank You”

Getting thanked feels good

nose fixture reference

Image for: nose fixture reference

How fixtures work in nose

tip: dictionary get() works like getattr

Image for: tip: dictionary get() works like getattr

Default values with dict

I’m annoyed with Python’s ternary operator

Image for: I’m annoyed with Python’s ternary operator

rant

pytest support for unittest style fixtures

Image for: pytest support for unittest style fixtures

Legacy post

nose support for unittest style fixtures

Image for: nose support for unittest style fixtures

Part of the nose series

Run a single test class with unittest, nosetests, pytest

Image for: Run a single test class with unittest, nosetests, pytest

How to, with examples

What happens when unittest fixtures fail

Image for: What happens when unittest fixtures fail

Exactly what happens to the flow of your test code when an exception is thrown in a fixture function.

unittest fixture syntax and flow reference

Image for: unittest fixture syntax and flow reference

a reference

How not to test, part 1

Image for: How not to test, part 1

I made some enemies with this post

pytest debug print logging in real time

Image for: pytest debug print logging in real time

How to get print to work with tests

regex search and replace example scripts

Image for: regex search and replace example scripts

A cheat sheet of code snippets

Python regex Search and Replace Examples

Image for: Python regex Search and Replace Examples

How I use search and replace in Python

Perl regex Search and Replace Examples

Image for: Perl regex Search and Replace Examples

How I use search and replace in perl

nose introduction

Image for: nose introduction

Initial look at nose

pytest introduction

Image for: pytest introduction

I think of pytest as the run-anything, no boilerplate, no required api, use-this-unless-you-have-a-reason-not-to test framework.
This is really where testing …

Confession … I still use perl on the command line

Image for: Confession … I still use perl on the command line

Using search and replace in perl

unittest introduction

Image for: unittest introduction

The unittest test framework is python’s xUnit style framework.
It is a standard module that you already have if you’ve got python version 2.1 or greater.
In …

doctest introduction

Image for: doctest introduction

The doctest test framework is a python module that comes prepackaged with Python. This post covers the basics of how to put doctests in your code, and outside …

Software API/CLI interface adapters

Image for: Software API/CLI interface adapters

While writing software, we are faced with lots and lots of interfaces.
The public interface for some tool or module or package or whatever is usually referred …

Stub for markdown.py

Image for: Stub for markdown.py

To explore the concepts of functional testing using python and python testing frameworks, I’m building a project to test, markdown.py on github.

In this post, …

Markdown.py requirements

Image for: Markdown.py requirements

I’ve decided to write my own Markdown script,
possibly for dubious reasons.

I’m getting antsy to code.

But before I get started on the testing and …

Why Markdown

Image for: Why Markdown

Markdown has very little to do with python testing.
But I need a project to test, so I’m writing my own Markdown script.
This is a brief introduction to …