A Simple PlistBuddy Tutorial

Good ol’ plist files. They are at the core of OS X for storing application settings and they work really well. If you have ever automated part of your OS X build or changed some cool hidden feature, you have probably used the defaults command to do so. The defaults command is great and is still recommended for simple things, but if you want to edit complex plist structures like arrays, dicts and nested structures, you’ll inevitably come across PlistBuddy. [Read More]

Selecting a Solid Code Editor

Hello guys, hope everyone is doing well. I’ll start this post by admitting that I absolutely love Sublime Text and already own a license for it. But, I’m a curious lad who likes to try new things and therefore I couldn’t help being interested in trying out the slew of new open source and also payware editors which are popping up. As you also can tell, I primarily develop in Python but do a lot of frontend work too, so CSS and Javascript are of interest. [Read More]

Running nose tests with plugins using the setuptools test command

The nose Python test framework is a really good choice for writing and running your tests. However, it seems that the author is deprecating the use of nose.collector which was used when running the test setuptools command: 1python setup.py test Furthermore, even in its current form, the nose collector doesn’t correctly work with plugins such as coverage.py. The recommended way is to use the nosetests setuptools command instead. Though, this presents several problems: [Read More]

Better Python version and environment management with pyenv

In the Setting up Virtual Development Environments for Python post, we discussed the use of pythonbrew for managing Python versions and their related virtualenvs. If you do enjoy pythonbrew, then be sure to check out pythonz which is now the active fork of the original project and has resolved almost all issues that I had originally reported. However, there is another alternative called pyenv which has several significant advantages. Probably one of the biggest is the fact that pyenv doesn’t depend on Python 2. [Read More]

Using the Python mock library to fake regular functions during tests

While writing unit tests in Python, there will often be times where you’ll need to fake the result of a function as testing against the actual function may be impossible. A simple example is a random function since one can’t predict what it will return. Another could be a database call for a database that’s only available in certain environments. Python’s mock library is the de facto standard when mocking functions in Python, yet I have always struggled to understand it from the official documentation. [Read More]