On Sat, Apr 5, 2008 at 12:54 PM, Aldo Cortesi <[EMAIL PROTECTED]> wrote: > Thus spake Matthieu Brucher ([EMAIL PROTECTED]): > > > > 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: import libpry class MySuite(libpry.AutoTree): def setUpAll(self): self.all_fixture = True def tearDownAll(self): self.all_fixture = False def setUp(self): self.fixture = True def tearDown(self): self.fixture = False def test_one(self): assert self.fixture assert self.all_fixture tests = [ MySuite() ] in those, this could be written like this: class Empty: pass obj = Empty() def setup(): obj.all_fixture = True def setup_func(): obj.fixture = True def teardown(): obj.all_fixture = False def teardown_func(): obj.fixture = False @with_setup(setup_func, teardown_func) def test_one(): assert self.fixture assert self.all_fixture nose gives you much more bang per line of code. -- mvh Björn -- http://mail.python.org/mailman/listinfo/python-list