[Zope3-dev] copied doctest in z3.zope3recipes for Windows support

Martijn Faassen faassen at startifact.com
Thu Aug 16 08:52:28 EDT 2007

Hi there,

I don't have any Windows knowledge, so my ability to review Roger's 
changes to add (much needed!) windows support to z3.zope3recipes is 

I do however notice that an entire doctest was more or less copied 
verbatim: README.txt got copied to WINDOWS.txt. The Windows version has 
some changes, and a few additions, but it's almost exactly the same.

Now if these were unit tests this would be less problematic, but this is 
a document as well, and as a result we now have two virtually identical 
documents to maintain. That seems wrong.

Looking at the changes in the test, I see a number of changes in the 
window version:

- One is the obvious addition of a whole section of windows-specific 
tests, from the 'test_winctl' section onwards. These can stay in their 
own document.

- in many cases an 'ls()' call happens and in Windows the naming of 
filenames is slightly different:

*nix                   Windows
----                   -------

debugzope              debugzope.exe / debugzope-script.py
runzope                runzope.exe / runzope-script.py

We should be able to resolve this by having the *test* gain awareness of 
being run on Windows. We could then write:

On *nix, we expect the following files to be generated::

   if platform_starnix:
      .. test code

On *windows however, we also need to generate .exe files, and it looks 
like this:

    if platform_windows:
      ... test code

It appears to be knowledge that would be useful for the test-reader to 
know about.

- Then the *nix tests test for the following output in many places:

  Generated script '/sample-buildout/bin/instance'.

while the Windows tests expect this not to be present. This is weird. I 
am assuming that this is buildout generated information, and that Roger 
was somehow testing with a different version of buildout than I am on 
Linux. I hope that we can make this difference go away by using a 
different version of buildout on Windows that also generates this output?

There is another place where buildout differences seem to be making a 
difference. In one location, the Windows tests are checking for the text 
'Uninstalling instance' and then later 'Installing instance', while in 
the Linux version 'Updating instance.' is used.

- in one place in the tests, instead of zc.zope3recipes.ctl, 
zc.zope3recipes.winctl is being imported from. The goal is to get the 
'main' function to run. The arguments to this 'main' function are identical.

We should be able to resolve this by making zc.zope3recipes.ctl's 
main()' delegate to the Windows version where needed. The test code can 
then be identical.

These are all the changes in the test code I can detect. It therefore 
seems quite feasible to merge them into a single test again, if at least 
we can work out the buildout output differences.




More information about the Zope3-dev mailing list