Testing in Django

I’ve been working with a team of developers on the BOS2 project, a new version of our successful Bristol Online Surveys (BOS) service. This completely new codebase is written from the ground up using a variety of tools and technologies many of  which are new to the developers on the project. For myself, I’ve not had any experience of Cassandra before, and aside from some light-touch Plone work in the past this is my first real Python (Django) project that I’ve worked on.

While I’m enjoying the experience, with a background in Java I’ve come to rely on an excellent testing ecosystem which is one of the areas where I feel Django falls short. It’s not that you can’t do what you want with the Django testing framework but (as this blog post shows) it makes you work harder to get there and it’s often easy to fall into traps as you build your tests. I don’t feel we’ve achieved nirvana with our test framework but we’re getting there. Continue reading

Python puzzler: the import statement and global variables

Recently I’ve joined the BOS team in helping develop the next generation of the survey software. This time round were using Django (a Python-based web framework), PostgreSQL and Cassandra (a NoSQL database).

Although I’ve dabbled with Python briefly in the past this is my first substantial Python-based project. As a new Python developer I hit rather confusing bug in our code recently that concerned the Python import statement and global variables. It’s an interesting little oddity that I thought would be worth writing about. Continue reading