ANN: pry unit testing framework
bjourne at gmail.com
Sat Apr 5 13:26:59 CEST 2008
On Sat, Apr 5, 2008 at 12:54 PM, Aldo Cortesi <aldo at nullcube.com> wrote:
> Thus spake Matthieu Brucher (matthieu.brucher at gmail.com):
> > How does it compare to the nose framework ?
> As far as the base unit testing functionality is concerned, I think
> they try to address similar problems. Both have assert-based testing
> with inspection and re-parsing of assert exceptions for better error
> messages. Both try to provide better fixture management. Both make
> programmatic test generation easier. Both have a command-line tool for
> running and gathering tests.
> I like nose, but I'm biased, and of course I think Pry has some
> advantages. One difference I'd point out is Pry's tree-based test
> structure, which provides a number of conveniences and features (much
> nicer test selection from the command line, for instance).
Isn't nose tree-based too? You can select both single test-cases
suites or directories to run.
Anyway, I don't think comparisions with nose is fair, because nose is
the best of the best and all other test runners fall short of it. :)
nose and nose-like test runners use automatic test case discovery, so
that you don't have to write redundant boilerplate like in PyUnit and
PyUnit-like frameworks. To take an example from Pry's manual:
self.all_fixture = True
self.all_fixture = False
self.fixture = True
self.fixture = False
tests = [
in those, this could be written like this:
class Empty: pass
obj = Empty()
obj.all_fixture = True
obj.fixture = True
obj.all_fixture = False
obj.fixture = False
nose gives you much more bang per line of code.
More information about the Python-list