James CookeJames Cooke

Posts tagged 'language:python'

Why isn’t the UK in DST yet?!

British Summer Time is due to start this weekend. However, for some reason, it’s three weeks after the usual USA switch over, rather than the usual two. Why is this? And when will it happen again?

Pipx’s upgrade is shallow, let’s go deeper

Software installed in pipx’s managed virtual environments can get stale. How can we update those packages and their dependencies?

An Ode to pipx

Using pipx has improved my daily development experience considerably.

Pytest’s cache and gitignore

Sanity checking Pytest’s .gitignore files.

It’s good to extract

Thoughts on the benefits of extracting library code from Python projects into their own packages.

AAA Part 2: Extracting Arrange code to make fixtures

This post explores how to extract arrangement code when working with the Arrange Act Assert pattern so that it can be used with certainty across the test suite.

Arrange Act Assert pattern for Python developers

This post introduces the Arrange Act Assert pattern of testing and shows how it can be used in a Python context with Pytest.

Comparing Django Q Objects in Python 3 with pytest

An updated simple assertion helper for comparing instances of Django’s Q objects using pytest in Python 3.

A successful pip-tools workflow for managing Python package requirements

Using pip-tools with multiple requirements files can be difficult. This post describes my current workflow that manages the complexity with a Makefile.

Django Factory Audit

Exploring the various model instance factories available for Django. Each factory is tested based on the quality of the instances it creates. Bonus: talk version and slides also available.

Cleaner unit testing with the Arrange Act Assert pattern

My PyConUK 2016 talk about the AAA pattern for unit tests and how using it can help us all make our tests cleaner, easier to read and as Pythonic as possible.

Python unittest: assertTrue is truthy, assertFalse is falsy

Exploring Python’s unittest module boolean assert methods and how they can be misleading in certain situations, but not if you RTFM of course.

Comparing Django Q Objects

A super simple assertion helper for comparing instances of Django’s Q objects.

Python generators and yield

Notes to myself on generators and how to create them with generator expressions and the yield statement.

Things to remember about decorators

Notes to myself about Python decorators with a focus on making them testable.

Pyramid London talk - A testing strategy for Pyramid Applications

Talk at Pyramid London meetup about testing strategies for Pyramid applications.