Skip to main content

Adventures in Python and unit testing

In the last month (due to a project at work), I had the opportunity to level up my Python. I think it got to the point where I figured out the terms to search for to pull up Google's foo.bar contest. :) And not only did I level up my Python, but also I finally witnessed how useful unit tests are. This really isn't a writeup about the merits and necessities of writing unit tests so much as it is a declaration what I've learned firsthand.

At the beginning of my career, my manager handed me a book about test-driven development. Intimated by junit and the codebase I was jumping into, I flipped through the book but didn't glean much from it. Eventually, I forgot about it, and writing unit tests never became part of my development workflow during the first many years of my career. And that book is probably still collecting dust on that bookshelf in my cubicle, to this very day.

After joining a company where unit tests are taken very seriously, I had to bite the bullet and write unit tests that actually mattered. It's a little weird at first, because like most things in life, you build first, then test. This last month, I think I finally discovered just how much unit tests increase developer productivity. I had to do some major rewrites in a short amount of time, but I interleaved writing unit tests and developing the core functionality of my project. Even with the rewrites, the unit tests helped me catch a lot of things because I wrote them with the design and expectation of the entire project in mind.

Aside from that, I've learned how to use setuptools and generators. Nice little adventures.

Comments

Popular posts from this blog

Compiling pgmodeler on Yosemite (with Homebrew)

Refer to  pgmodeler installation . Steps: Clone the pgmodeler git repo. Use Homebrew to install qt5 (5.4.2, see here ), libxml2, and postgresql. Edit the pgmodeler.pri (not .pro) file and change these variables: PGSQL_LIB = /usr/local/opt/postgresql/lib/libpq.dylib PGSQL_INC = /usr/local/opt/postgresql/include XML_INC = /usr/local/opt/libxml2/include/libxml2 XML_LIB = /usr/local/opt/libxml2/lib/libxml2.dylib Follow instructions to compile pgmodeler (you might need to put Qt's binaries in your PATH. I was lazy and didn't). $ /usr/local/opt/qt5/bin/qmake pgmodeler.pro $ make $ make install $ cd /Applications $ /usr/local/opt/qt5/bin/macdeployqt pgmodeler.app -executable=pgmodeler.app/Contents/MacOS/pgmodeler-ch -executable=pgmodeler.app/Contents/MacOS/pgmodeler-cli Then I was able to do $ open pgmodeler.app

pgmodeler build in Debian Jessie

This is my qmake version: $ qmake -v QMake version 3.0 Using Qt version 5.3.2 in /usr/lib/x86_64-linux-gnu I had to edit linuxdeploy.sh: 1. Add "-makefile" to the QMAKE_ARGS variable: $ qmake -h Usage: /usr/lib/x86_64-linux-gnu/qt5/bin/qmake [mode] [options] [files] where mode is either "-makefile" (default) or "-project" QMAKE_ARGS="-makefile -r -spec linux-clang" 2. Right before "Running qmake...", I added another line to include pgmodeler.pro in the qmake invocation: QMAKE_ARGS="$QMAKE_ARGS pgmodeler.pro" Then I ran ./linuxdeploy.sh -no-qt-libs (https://github.com/pgmodeler/pgmodeler/issues/674)

The end of summer

It's been a wild year. Gains and losses. COVID-19 and the shelter in place. Lately, fires. Today was a very dark day, literally. For about half the daylight hours, there was so much ash in the air that it looked like it was close to sunset, but it was definitely not anywhere near as beautiful. Red sun following us everywhere. Bubonic plague found on fleas in Lake Tahoe. The list goes on and on. Everyone is tired. Exhausted. Burnt out. There is no respite, just a new normal that seems like an even steeper climb than before. Sleep gives way to another day with no refreshment. Yes, that's how things seem. But there have also been bright moments. Time spent with family, especially with the little one. Growing and nurturing plants, building things, trying new recipes, going to the store to shop for dinner, reading books, coloring with crayons... We grow closer together, weaving together a blanket of love and memories that we wrap ourselves in.