[Zope-dev] Re: ZCML and 'zopectl test'?

2007-01-07 Thread whit
I just made ZopeTestCase defer all loading until it's layer(essentially 
deferring the import of ZopeLite which is sort of a subpar way to handle 
things and using a registry to handle installProducts).  most of what 
happens in zopelite itself should be the layer(rather than carefully 
isolating the import)


http://svn.zope.org/Zope/branches/whitmo-2.10-layers/

lurker, comments?  from what I remember, the only issue was with the 
sandbox tests(for functional tests). basically in sandboxed test you 
need a fresh zodb for each test iirc.


-w


___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Re: ZCML and 'zopectl test'?

2007-01-07 Thread Philipp von Weitershausen

On 7 Jan 2007, at 20:44 , Tres Seaver wrote:


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Philipp von Weitershausen wrote:

Andreas Jung wrote:
I added Products/PageTemplates/configure.zcml to register an  
utility.

That works fine when running Zope however "zopectl test" won't work
properly anymore because the utility registration does not seem to
happen when running the tests. Bug or feature?


Tests need to do their own setup. ZCML isn't magically loaded for  
tests,

unless those tests are run within a layer that loads all ZCML before
running the tests.

So, there are two options:
- modify the setUp() of the tests in question to
provideUtility(your_utility)
- make the respective tests run in a layer that loads the ZCML. I  
don't
think layer support is on the trunk yet. Whit Morriss has a branch  
where

he added that to Zope 2, but it still hasn't been merged :(


I'm pretty sure that layer support is on the 2.10 branch and the  
trunk:

the CMF trunk tests now depend on it::


I phrased that wrongly. Layer support from the test runner  
perspective is in Zope 2 since Zope 2.9. But Zope 2 itself actually  
using test layers is not in any release branch.




$ bin/zopectl show
zdctl/zdrun options:
schemafile:
'/home/tseaver/projects/Zope-CVS/Zope-2.10-branch/lib/python/Zope2/ 
Startup/zopeschema.xml'

...
$ bin/zopectl test
Running tests via: /home/tseaver/projects/Zope-CVS/bin/python2.4
/home/tseaver/projects/Zope-CVS/Zope-2.10-branch/bin/test.py -v
- --config-file
/home/tseaver/projects/CMF/cmf_test/z210_cmfhead/etc/zope.conf
Parsing /home/tseaver/projects/CMF/cmf_test/z210_cmfhead/etc/zope.conf
Running tests at level 1
Running unit tests:
  Running:
.. 
.. 
.. 
.. 
.. 
.. 
.. 
.. 
.. 
.. 
.. 
...

  Ran 809 tests with 0 failures and 0 errors in 11.052 seconds.
Running Products.CMFCore.testing.FunctionalZCMLLayer tests:
  Set up Products.CMFCore.testing.FunctionalZCMLLayer in 1.603  
seconds.

...
Tearing down left over layers:
  Tear down Products.GenericSetup.testing.ExportImportZCMLLayer in  
0.000

seconds.
Total: 1351 tests, 0 failures, 0 errors


Tres.
- --
===
Tres Seaver  +1 540-429-0999  [EMAIL PROTECTED]
Palladion Software   "Excellence by Design"http://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFoU2z+gerLs4ltQ4RAmxhAKDUo3oEHv8bUIoW/dLMmpeHvMWvdACgy1wU
0P+mwfqR/0MVCICtu5AZ568=
=fuE+
-END PGP SIGNATURE-


___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Re: ZCML and 'zopectl test'?

2007-01-07 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Philipp von Weitershausen wrote:
> Andreas Jung wrote:
>> I added Products/PageTemplates/configure.zcml to register an utility.
>> That works fine when running Zope however "zopectl test" won't work 
>> properly anymore because the utility registration does not seem to 
>> happen when running the tests. Bug or feature?
> 
> Tests need to do their own setup. ZCML isn't magically loaded for tests, 
> unless those tests are run within a layer that loads all ZCML before 
> running the tests.
> 
> So, there are two options:
> - modify the setUp() of the tests in question to 
> provideUtility(your_utility)
> - make the respective tests run in a layer that loads the ZCML. I don't 
> think layer support is on the trunk yet. Whit Morriss has a branch where 
> he added that to Zope 2, but it still hasn't been merged :(

I'm pretty sure that layer support is on the 2.10 branch and the trunk:
the CMF trunk tests now depend on it::

$ bin/zopectl show
zdctl/zdrun options:
schemafile:
'/home/tseaver/projects/Zope-CVS/Zope-2.10-branch/lib/python/Zope2/Startup/zopeschema.xml'
...
$ bin/zopectl test
Running tests via: /home/tseaver/projects/Zope-CVS/bin/python2.4
/home/tseaver/projects/Zope-CVS/Zope-2.10-branch/bin/test.py -v
- --config-file
/home/tseaver/projects/CMF/cmf_test/z210_cmfhead/etc/zope.conf
Parsing /home/tseaver/projects/CMF/cmf_test/z210_cmfhead/etc/zope.conf
Running tests at level 1
Running unit tests:
  Running:
.
  Ran 809 tests with 0 failures and 0 errors in 11.052 seconds.
Running Products.CMFCore.testing.FunctionalZCMLLayer tests:
  Set up Products.CMFCore.testing.FunctionalZCMLLayer in 1.603 seconds.
...
Tearing down left over layers:
  Tear down Products.GenericSetup.testing.ExportImportZCMLLayer in 0.000
seconds.
Total: 1351 tests, 0 failures, 0 errors


Tres.
- --
===
Tres Seaver  +1 540-429-0999  [EMAIL PROTECTED]
Palladion Software   "Excellence by Design"http://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFoU2z+gerLs4ltQ4RAmxhAKDUo3oEHv8bUIoW/dLMmpeHvMWvdACgy1wU
0P+mwfqR/0MVCICtu5AZ568=
=fuE+
-END PGP SIGNATURE-

___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Re: ZCML and 'zopectl test'?

2007-01-07 Thread Paul Winkler
On Sun, Jan 07, 2007 at 12:14:32PM +0100, Philipp von Weitershausen wrote:
> So, there are two options:
> - modify the setUp() of the tests in question to 
> provideUtility(your_utility)
> - make the respective tests run in a layer that loads the ZCML. I don't 
> think layer support is on the trunk yet. Whit Morriss has a branch where 
> he added that to Zope 2, but it still hasn't been merged :(

The testrunner in zope 2 has supported layers for quite a while.  
I currently use layers in my tests with zope 2.9.1.  
TestLayersHowTo on zopewiki.org gives a working example.

Or do you mean something else by "layer support"?

-- 

Paul Winkler
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Re: ZCML and 'zopectl test'?

2007-01-07 Thread Philipp von Weitershausen

Andreas Jung wrote:

I added Products/PageTemplates/configure.zcml to register an utility.
That works fine when running Zope however "zopectl test" won't work 
properly anymore because the utility registration does not seem to 
happen when running the tests. Bug or feature?


Tests need to do their own setup. ZCML isn't magically loaded for tests, 
unless those tests are run within a layer that loads all ZCML before 
running the tests.


So, there are two options:
- modify the setUp() of the tests in question to 
provideUtility(your_utility)
- make the respective tests run in a layer that loads the ZCML. I don't 
think layer support is on the trunk yet. Whit Morriss has a branch where 
he added that to Zope 2, but it still hasn't been merged :(


Philipp

--
http://worldcookery.com -- Professional Zope documentation and training
2nd edition of Web Component Development with Zope 3 is now shipping!
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )