Hi Sridhar, thanks for sharing the use case!
On Thu, May 21, 2009 at 15:29 -0700, Sridhar Ratnakumar wrote: > > holger: [...] The new way to parametrize test is meant to substitute > > yield usage of test-functions aka "generative tests", also used by > > nosetests. yield-style Generative tests have received criticism and > > despite being the one who invented them, i mostly agree and recommend > > not using them anymore. > > I use `yield' to run 'sub-tests' in sequential order. For example, in > this particular usecase: > > http://gist.github.com/115787 > > You'll notice I have to run test_install, test_list_all, test_import, > test_remove in that *order*. yes, ok. are you aware that py.test runs test function in the order in which they appear in the test module file, btw? > It is not possible to make them methods of a class and use > `pytest_generate_tests' to run them in sequential order because each of > these sub-tests, besides the order, also depend on their position of > execution (i.e., test_search is to be run after the statement > ``c.do_update(None, None, repo_root_url)``) > > `yield' achieves this elegantly; I don't know how one would achieve this > requirement otherwise. If one of the yielded tests fails, should the rest of the yielded tests better not run at all? Would you like to reuse the yielded test functions for other test cases? > BTW, there is no way for me to use funcargs in yield based tests (which > is why I'm calling the setup function, `prepare_client', manually). That's intentional because of the deprecation intent. However, i'd like to understand your use case better. I get the impression that something else/more than the current funcarg/generate mechanisms is needed to address it nicely. So please also state openly any problems/wishes you have with the current yield-way of doing things. thanks & cheers, holger > Cheers, > Sridhar > > On 09-05-13 11:19 AM, holger krekel wrote: > > Hi folks, > > > > for those not following my blog, here is my post > > about the newstyle generative tests which are > > to substitute and improve on "yield" based tests, > > among other parametrization methods: > > > > http://tetamap.wordpress.com/2009/05/13/parametrizing > > > > Hope to get another py.test beta out next week that would > > contain this. I am still set to finish refining and > > documenting extension hooks ... the above was part of that > > effort although i originally planned the "parametrizing" hook > > as a post 1.0 feature. > > > > Anyway, let me know what you think - there is still time to do > > some adjustments or changes especially to funcargs. > > > > cheers, > > holger > > > > _______________________________________________ > py-dev mailing list > py-dev@codespeak.net > http://codespeak.net/mailman/listinfo/py-dev > -- Metaprogramming, Python, Testing: http://tetamap.wordpress.com Python, PyPy, pytest contracting: http://merlinux.eu _______________________________________________ py-dev mailing list py-dev@codespeak.net http://codespeak.net/mailman/listinfo/py-dev