[ZCM] [ZC] 1798/ 3 Comment "ZopeTestCase and Zope.Startup() interactions"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Sun Jun 5 15:45:19 EDT 2005


Issue #1798 Update (Comment) "ZopeTestCase and Zope.Startup() interactions"
 Status Pending, Zope/bug medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/1798

==============================================================
= Comment - Entry #3 by shh on Jun 5, 2005 3:45 pm

Ok, so now that I've actually looked at the branch <wink> I think it is unnecessary in its current form. ZTC can detect whether Zope.startup() has been run just fine (by checking Zope._began_startup), and turn ZopeLite.installProduct() into a noop. I think that's the intention here, anyway.

________________________________________
= Comment - Entry #2 by shh on Jun 5, 2005 2:26 pm

"Discovered some tricky interactions" is not entirely correct. I knew about this all along ;-)

One of the very reasons of ZTC's existence is that Zope.startup() was perceived to suck for testing. This is why there is a ZopeLite module in the first place. Zope.startup() pulls in *all* products which may be fine for testing the Zope core, but is not desirable when testing add-on products. That's because

  a) It is unbearably slow.
  b) You never really know what is actually installed.

So, mixing ZTC and non-ZTC tests in a single run was never in the cards, and I don't consider this a "bug" either.

Let's see what we can do once Lennart has landed his branch...

________________________________________
= Request - Entry #1 by regebro on Jun 2, 2005 9:19 am

Stefan Holek and I have discovered some tricky interactions of ZopeTestCase tests and tests using Zope.Startup().

1. If you first run a test that uses Zope.Startup() and later run a test using ZopeTestCases installProduct() the product will get installed twice, first by Zope.Startup() and then by installProduct. This is not only a waste of processing time, it also causes test failures if the product you install uses CMFStetup. This is probably why this bug hasn't appeared before, CMFSetup is pretty new.

A fix for this exists in  svn+ssh://regebro@svn.zope.org/repos/main/Zope/branches/regebro-product_installation_tracking and will be merged into trunk and 2.8 soon (like today or tomorrow).

2. If you first run a test using ZopeTestCase, and then run a test using Zope.Startup() Zope.Startup() will not install any products. I haven't tested this (it's according to Stefan Holek). This will happen for example if you have Archetypes installed and run all tests in Products, with "bin/zopectl test" or similar.

I don't have a solution for this yet.

==============================================================



More information about the Zope-Collector-Monitor mailing list