Python: testing beyond exceptions

Recently working on some code I was doing some basic tests that checked for an exception being raised. The tests looked like this: def test_user_identification_is_valid_option(self): with self.assertRaises(ValueError): example_seller(products=[ 'id': 'hai', 'description': 'a description', 'recurrence': None, 'user_identification': True, }]) def test_…

Linux: Spotify Track Notifier with added D-Bus love

I've recently updated the spotify notifier example I'd previously posted as an example along with my spotify screensaver script. First, I made an update to have it listen to the PropertiesChanged signal. Annoyingly for some unknown reason this signal isn't visible in D-feet which had led to the erroneous assumption…

Fake SMTP server with Python

The other day a colleague was testing some code which relied on sending mail to a local mailserver and it was failing when the mailserver couldn't be found. Needing to install postfix seemed overkill so I decided to look into what could be done to make a fake smtp service.…

Cross Platform Keyring Library for Python

Kang Zhang has been busy on a Google Summer of Code project to create a cross platform keychain library for Python. The Python keyring lib provides a easy way to access the system keyring service from python. It can be used in any application that needs safe password storage. It…

Simple Switching of VirtualEnv Environments

If you're using Python for any kind of serious development virtualenv is highly recommended as a way to sandbox dependencies and allow you to run different libraries and or python versions for different projects. For more on Virtualenv and how to use it see VirutalEnv on PyPi I wanted a…

Fixing setuptools "TypeError: swig_sources()" error

I was trying to update to a newer version of Jinja2 on osx to meet Zine dependencies and I got the following error: Traceback (most recent call last): […snip…] File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/setuptools/command/build_ext.py", line 77,…