Re: [Zope-dev] Puzzle re zope.pytest
Hi Jeff, On Wed, 16 May 2012 03:40:17 -0500 Jeff Rush wrote: Are many folks using zope.pytest? We're looking into it but, for such a small amount of code, are finding it a bit odd and seemingly broken. No, I don't think many folks are using it right now. zope.pytest was a quick shot to check out, what is possible with py.test in Zope environments and to give folks used to py.test an easier entrance to the Zope world. However, we got stuck a bit with some principal problems (see below). Breaking down the basic creation of an application object, here is what the code does, with indentation to show what a method call performs: create_app() db = setup_db() storage = DemoStorage(name) db = DB(storage, database_name=name) db.setActivityMonitor( ZODB.ActivityMonitor.ActivityMonitor() ) notify( zope.processlifetime.DatabaseOpened(db) ) return db connection = setup_connection(db) return db.open() connection.root()[ZopePublication.root_name]['test'] = site_root My issues are: 1) the DatabaseOpened event is sent out _before_ the ZODB is actually opened, making it hard to use handlers to initialize a test layout in the ZODB. The main idea of zope.pytest is to provide a ready-to-use db without much setup stuff included from the users side. It's for users that want some plain ZODB with some `site` and don't care much where it comes from or how it looks like. If you want your very own and special setup or test layout, you yet have to write the setup/teardown code down yourself. 2) there are no other events emitted, such as after root is initialized. Please see above. I nevertheless understand that your use-case is common. zope.pytest could/should provide additional helpers to create such customized test layouts. 3) there is a key lookup of ZopePublication.root_name inside connection.root() before any code has _set_ such a key, raising a key lookup exception in my basic evaluation pgm. I think this is normally done by zope.app.appsetup, via a subscriber. Never had this problem, so I cannot tell much. 4) there are no examples of tests that use the 'test' subscript, and I'm puzzled by the extra level of indirection instead of just using ZopePublication.root_name in test_XXX functions. Well, that's a matter of abstraction. We wanted to put away DB setup stuff from the user. You simply should not have to care for things like `root_name`. This approach, of course, finds it limits when you want DBs already filled with data, etc. 5) the unit tests for zope.pytest itself are failing with: from zope.interface.interfaces import ComponentLookupError E ImportError: cannot import name ComponentLookupError You need at least zope.interface 3.8.0. Looks like you're using an older version. I've googled to find others using zope.pytest, to see examples of correct usage in a ZODB-based testing environment, without luck. The main problem why we got stuck is test separation. Especially the setup and teardown of ZCA registrations, which should happen before and after each single test and might be different for certain groups of tests. So we looked for some replacement of the way zope.testing layers are doing it, but still could not find anything similar in py.test which makes it hard to use already available techniques (for instance provided by plone.testing) as there seems to be no hook in py.test to trigger this stuff at the right point in time. I admit, though, that I am not too deep into py.test. If you're an experienced py.test user, we might could work out something together and make it more usable. I'd be happy to learn more about py.test from someone more experienced. If, however, you're after a quick, ready-to-use, comprehensive framework for testing Zope applications, you might be better off with other approaches like the regular Zope testrunner and related libs. Best regards, -- Uli signature.asc Description: OpenPGP digital signature ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Puzzle re zope.pytest
On Thu, May 17, 2012 at 5:52 PM, Uli Fouquet u...@gnufix.de wrote: [...snip...] The main problem why we got stuck is test separation. Especially the setup and teardown of ZCA registrations, which should happen before and after each single test and might be different for certain groups of tests. So we looked for some replacement of the way zope.testing layers are doing it, but still could not find anything similar in py.test which makes it hard to use already available techniques (for instance provided by plone.testing) as there seems to be no hook in py.test to trigger this stuff at the right point in time. Something like this should work: def pytest_funcarg__app(request): Create app funcarg return request.cached_setup( setup=_get_app, #this should return an app object teardown=_release_app, #destroy things here scope='function') def test_something(app): pass Regards, Baiju M ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] zope.i18n plural form support
Hi, I added the plural form support (see a corresponding ticket here: https://bugs.launchpad.net/zope.i18n/+bug/161985) in a separate branch: https://code.launchpad.net/~thomas-massmann/zope.i18n/plural. This code was mainly implemented during the 2012 Plonekonf in Munich. It is already in production since 3 months in a project I'm developing right now. Please note that zope.i18nmessageid needs to be taken from this branch to work: https://code.launchpad.net/~thomas-massmann/zope.i18nmessageid/plural. Extracting plural messages is supported by xgettext by default. Zope tools like i18nduder have to be adjusted (they don't support ungettext right now). I already adjusted lingua by Wichert Akkerman (https://github.com/tmassman/lingua) - the pull request is still open. Cheers, Thomas ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] zope-tests - FAILED: 3, OK: 41
This is the summary for test reports received on the zope-tests list between 2012-05-16 00:00:00 UTC and 2012-05-17 00:00:00 UTC: See the footnotes for test reports of unsuccessful builds. An up-to date view of the builders is also available in our buildbot documentation: http://docs.zope.org/zopetoolkit/process/buildbots.html#the-nightly-builds Reports received Bluebream / Python2.5.5 64bit linux Bluebream / Python2.6.7 64bit linux Bluebream / Python2.7.2 64bit linux ZTK 1.0 / Python2.4.6 Linux 64bit ZTK 1.0 / Python2.5.5 Linux 64bit ZTK 1.0 / Python2.6.7 Linux 64bit ZTK 1.0dev / Python2.4.6 Linux 64bit ZTK 1.0dev / Python2.5.5 Linux 64bit ZTK 1.0dev / Python2.6.7 Linux 64bit ZTK 1.1 / Python2.5.5 Linux 64bit ZTK 1.1 / Python2.6.7 Linux 64bit ZTK 1.1 / Python2.7.2 Linux 64bit ZTK 1.1dev / Python2.5.5 Linux 64bit ZTK 1.1dev / Python2.6.7 Linux 64bit ZTK 1.1dev / Python2.7.2 Linux 64bit Zope 3.4 KGS / Python2.4.6 64bit linux Zope 3.4 KGS / Python2.5.5 64bit linux Zope 3.4 Known Good Set / py2.4-32bit-linux Zope 3.4 Known Good Set / py2.4-64bit-linux Zope 3.4 Known Good Set / py2.5-32bit-linux Zope 3.4 Known Good Set / py2.5-64bit-linux Zope-2.10 Python-2.4.6 : Linux Zope-2.11 Python-2.4.6 : Linux Zope-2.12 Python-2.6.6 : Linux Zope-2.12-alltests Python-2.6.6 : Linux Zope-2.13 Python-2.6.6 : Linux Zope-2.13-alltests Python-2.6.6 : Linux Zope-trunk Python-2.6.6 : Linux Zope-trunk-alltests Python-2.6.6 : Linux winbot / ZODB_dev py_265_win32 winbot / ZODB_dev py_265_win64 winbot / ZODB_dev py_270_win32 winbot / ZODB_dev py_270_win64 [1]winbot / zope.app.appsetup_py_265_32 [2]winbot / zope.configuration_py_265_32 [3]winbot / zope.configuration_py_265_32 winbot / ztk_10 py_254_win32 winbot / ztk_10 py_265_win32 winbot / ztk_10 py_265_win64 winbot / ztk_11 py_254_win32 winbot / ztk_11 py_265_win32 winbot / ztk_11 py_265_win64 winbot / ztk_11 py_270_win32 winbot / ztk_11 py_270_win64 Non-OK results -- [1]FAILED winbot / zope.app.appsetup_py_265_32 https://mail.zope.org/pipermail/zope-tests/2012-May/063172.html [2]FAILED winbot / zope.configuration_py_265_32 https://mail.zope.org/pipermail/zope-tests/2012-May/063174.html [3]FAILED winbot / zope.configuration_py_265_32 https://mail.zope.org/pipermail/zope-tests/2012-May/063165.html ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )