At a local Python meetup, there were several attendees that weren't familiar with pytest
, which gave me the idea to make this post as a primer on how I use pytest
. This isn't going to be a comprehensive review of pytest
and how to use it. For that, pick up …
-
-
Django Tasks - Cronjobs vs Celery
Like my previous vs post, this isn't a showdown. Instead, this post is about matching the solution to the problem. The tl;dr is that Celery is great at what it does, but it requires more infrastructure and setup than I needed to solve my problem.
The Problem to Solve …
-
[TIL] Using Fixtures with pytest `parametrize`
For longer than I care to admit, I was running my end to end tests in only Firefox. I thought it would be trivial to add a fixture to have my tests run using multiple browsers. Unfortunately, there isn't an easy way in
pytest
to use fixtures as parametrized values … -
[TIL] Mocking Chained Calls
At work last week, I was asked to write tests for code that reaches out to Twilio's verify service. Here is what that code looks like (from the Twilio docs):
client = Client(account_sid, auth_token) verification = client.verify \ .v2 \ .services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .verifications \ .create(to='+15017122661', channel='sms')
I was able to …
-
Strategies for a Long Running Side Project
At DjangoConUS 2023, I gave a lighting talk with this title. It was a lot of fun, and I'd suggest you try to give a lightning talk if you haven't before. It's a great way to try giving a talk at a conference without having to commit to a full …
-
Using SQLite for a Django application on fly.io
I'd like to run a few small apps I've been developing for learning purposes (to do list, etc.) on a cheap or free platform as a service (PaaS) provider so I don't have to worry about a full deployment setup like I have on my main project. These projects aren't …
-
Moving from Django Microframework to Django
At DjangoConUS 2019, Carlton Gibson gave a talk called Using Django as a Micro-Framework, where he demonstrated a single file implementation of "Hello, World!" in Django.
At the sprints during DjangoConUS 2023, Paolo Melchiorre showed off an even more minimal version that sparked some great discussion. Specifically, the usage of …
-
Aliases, pip, and dotfiles
Since my last post on aliases, I've added a few new aliases. Two are from Boost Your Django DX, which I'd highly recommend. The first is a straight cut from the book:
alias pip="python -m pip"
Using
python -m pip
instead ofpip
ensures you are using the version … -
Testing Stripe Integration in Django
I have been using Stripe to process payments for my company AstroVenture (see more context in a previous post here) for a couple of years now, and it has worked great. One thing that took me quite a while to figure out was how to test that we were properly …