When I use zopeproject to create a project, the project name and the
package name are the same... ie: $HOME/py24/MYPROJ/src/MYPROJ/...

Not quite. By default, the project name will be used as the directory name for the sandbox and as the name of the egg (in setup.py). The lower case of the project name will be used for the package name.

Can I override this to get a package name that is different than the
project name?

* The name of the directory containing the sandbox is completely irrelevant. You can completely move it around, so long as you run bin/buildout afterwards.

* The name of the package is completely arbitrary as well. You may rename it if you wish. Just make sure you update every occurrence of that name in the Python code and ZCML as well.

* The name of the egg is defined in setup.py::


You may change it any time, as long as you also update buildout.cfg (where the egg name is mentioned a couple of times) and then run bin/buildout.

Thanks for bringing up this question. I will add this to zopeproject's README.txt file.

Also, when I run bin/test, I get:
Running tests at level 1 Running zope.app.testing.functional.Functional tests:
    Set up zope.app.testing.functional.Functional Traceback (most recent call  
 line 539, in include
 line 427, in openInOrPlain
  IOError: [Errno 2] No such file or directory: 

However, I find that there is such an ftesting.zcml file - just not
in the "right" place. Symlinking/copying it solves the problem:

ln -s $HOME/py24/MYPROJ/src/MYPROJ/ftesting.zcml

What gives?

It seems you're using the old default functional test layer from zope.app.testing.functional. In Zope 3 instances there used to be a global ftesting.zcml that this layer would look for and load. In a buildout, that'd be the parts/test directory.

Nowadays we define package-specific functional test layers. Your zopeproject-generated code does that too. It comes with a custom ftesting.zcml (which you found already) and defines a FunctionalLayer in pkg.testing based on that file. You should apply this layer to your functional test suites.

For your convenience, the pkg.testing module also defines FunctionalDocFileSuite, FunctionalDocTestSuite and a FunctionalTestCase variants with that layer applied already. So if you import them for pkg.testing rather than zope.app.testing.functional, you won't have to do this symlinking.

This is documented already, by the way: http://pypi.python.org/pypi/zopeproject#writing-functional-tests

http://worldcookery.com -- Professional Zope documentation and training

Zope3-users mailing list

Reply via email to