13 items tagged “unittests”
2022
How I build a feature
I’m maintaining a lot of different projects at the moment. I thought it would be useful to describe the process I use for adding a new feature to one of them, using the new sqlite-utils create-database command as an example.
[... 2,779 words]2020
How to cheat at unit tests with pytest and Black
I’ve been making a lot of progress on Datasette Cloud this week. As an application that provides private hosted Datasette instances (initially targeted at data journalists and newsrooms) the majority of the code I’ve written deals with permissions: allowing people to form teams, invite team members, promote and demote team administrators and suchlike.
[... 933 words]2010
Unit Testing Achievements. A plugin for Python’s nose test runner that adds achievements—“Night Shift: Make a failing suite pass between 12am and 5am.”
rlisagor’s freshen. A Python clone of Ruby’s innovative Cucumber testing framework. Tests are defined as a set of plain-text scenarios, which are then executed by being matched against test functions decorated with regular expressions. Has anyone used this or Cucumber? I’m intrigued but unconvinced—are the plain text scenarios really a useful way of defining tests?
2009
Test-Driven Heresy. Tim Bray advocates TDD for maintenance development, but argues that it may not be as useful during the exploratory, greenfield development phase of a project.
Right now, pypy compiled with JIT can run the whole CPython test suite without crashing, which means we're done with obvious bugs and the only ones waiting for us are really horrible.
Django now has fast tests. Changeset 9756 switched Django’s TestCase class to running tests inside a transaction and rolling back at the end (instead of doing a full dump and reload). “Ellington’s test suite, which was taking around 1.5-2 hours to run on Postgres, has been reduced to 10 minutes.”
2008
QUnit. The jQuery unit testing framework is now documented and supported as a separate project.
Django on Jython (via) Outstanding work from Jim Baker and the Jython team: Django now runs on the modern branch of Jython, with a couple of patches and some failed doctests due to dictionary order (a problem with Django’s test suite).
2007
Mock—Mocking and Test Utilities (via) New mocking library for Python based on the “action ... assertion” pattern (as opposed to the more common “record ... replay”).
Using the jQuery test suite for your own projects. jQuery’s test suite has clever start(), stop() and expect() methods for running assertions within asynchronous code.
Rails 1.2.1 Impression. I hadn’t seen assert_select before, which lets you unit test generated HTML using CSS selectors; a really neat idea.
nose. Really nice Python unit testing tool—run ’nosetests somedir’ and it finds and executes every unittest (and test_like function) it can find in that directory tree.