Hi,

On 10 January 2012 12:15, Thomas Maier <hay...@gmail.com> wrote:
> This code works without py.test or nosetests. For example if I use print
> instead of 'assert'.
> Both py.test and nosetests failed to execute this correctly.
> Or maybe they do execute it correctly, I just don't understand it..:)
> They both report only single test was executed.
> I would like to see test report for each method executed in 'for' loop.
> Is it possible?

For nose, I *think* you can basically achieve what you want by turning
test_run() into a generator (by essentially replacing the call to the
test_method() with a suitable "yield" statement.   See here:
http://readthedocs.org/docs/nose/en/latest/writing_tests.html#test-generators

Additionally you might also look at the TestLoader functionality for
taking further control over how and where your tests are loaded, e.g.
see for example nose.loader.loadTestsFromGenerator() or
nose.loader.loadTestsFromGeneratorMethod() (or indeed all the other
methods) here:
http://readthedocs.org/docs/nose/en/latest/api/loader.html

HTH, my $0.02 worth,

Walter
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to