[Zope3-dev] Re: SVN: Zope3/trunk/src/zope/configuration/tests/test_xmlconfig.py Make sure including zope.app.zcmlfiles in configuration works.

2007-02-22 Thread Baiju M

Philipp von Weitershausen wrote:


Baiju M wrote:


Log message for revision 72757:
  Make sure including zope.app.zcmlfiles in configuration works.



I fail to see the point of this test. This is a doctest, I would at 
least expect one line explaining why we need to test loading 
zope.app.zcmlfiles.


Also, why does this need to be in zope.configuration? It seems wrong 
introducing this kind of dependency, evne if it's just for testing.


I realise that the place of that test is wrong, I will revert it.



I do realize that zope.configuration now has some code to support 
backward compatibility of . *This* would 
be something worthwile testing, I suppose, though perhaps in a way 
that would prevent actually loading all of the zope.app configuration 
(perhaps toggling the execution of ZCML actions to false would be a 
solution).


This test loads a fair bit of stuff, pretty close to a functional test 
setup. This has to be torn down (which is pretty hard to do, hence the 
functional layers so far don't implement tearDown).


Since xmlconfig.include method only parse and not execute ZCML, toggling 
the execution of ZCML actions to false is not required.




+>>> try:
+... xmlconfig.include(context, 'file_not_exists.zcml', 
zope.app.zcmlfiles)

+... except IOError, msg:
+... 'OK'
+'OK'
+"""



I think the preferred way to test for exceptions in doctests is:

  >>> xmlconfig.include(context, 'file_not_exists.zcml', 
zope.app.zcmlfiles)

  Traceback (most recent call last):
  IOError: ...


Thanks, I will change the other tests like that.

Regards,
Baiju M

___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] Re: SVN: Zope3/trunk/src/zope/configuration/tests/test_xmlconfig.py Make sure including zope.app.zcmlfiles in configuration works.

2007-02-22 Thread Philipp von Weitershausen

Baiju M wrote:

Log message for revision 72757:
  Make sure including zope.app.zcmlfiles in configuration works.


I fail to see the point of this test. This is a doctest, I would at 
least expect one line explaining why we need to test loading 
zope.app.zcmlfiles.


Also, why does this need to be in zope.configuration? It seems wrong 
introducing this kind of dependency, evne if it's just for testing.


I do realize that zope.configuration now has some code to support 
backward compatibility of . *This* would 
be something worthwile testing, I suppose, though perhaps in a way that 
would prevent actually loading all of the zope.app configuration 
(perhaps toggling the execution of ZCML actions to false would be a 
solution).


This test loads a fair bit of stuff, pretty close to a functional test 
setup. This has to be torn down (which is pretty hard to do, hence the 
functional layers so far don't implement tearDown).



+def test_include_of_zope_app_zcmlfiles():
+"""
+>>> context = config.ConfigurationMachine()
+>>> xmlconfig.registerCommonDirectives(context)
+>>> import zope.app.zcmlfiles
+
+>>> xmlconfig.include(context, package=zope.app.zcmlfiles)
+
+>>> xmlconfig.include(context, 'configure.zcml', zope.app.zcmlfiles)
+>>> xmlconfig.include(context, 'ftesting.zcml', zope.app.zcmlfiles)
+>>> xmlconfig.include(context, 'menus.zcml', zope.app.zcmlfiles)
+>>> xmlconfig.include(context, 'meta.zcml', zope.app.zcmlfiles)
+>>> try:
+... xmlconfig.include(context, 'file_not_exists.zcml', 
zope.app.zcmlfiles)
+... except IOError, msg:
+... 'OK'
+'OK'
+"""


I think the preferred way to test for exceptions in doctests is:

  >>> xmlconfig.include(context, 'file_not_exists.zcml', 
zope.app.zcmlfiles)

  Traceback (most recent call last):
  IOError: ...


--
http://worldcookery.com -- Professional Zope documentation and training
Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com