[Zope3-dev] Path used in test.py for Zope 3 and individual packages.

Baiju M baiju.m.mail at gmail.com
Sat Oct 21 06:10:27 EDT 2006


Hi,
    I was experimenting with creating some eggs [1] .
When I tried to run tests of zope.configuration (Individual  package)
I got some test failures, this is due to a path problem:

Failure in test checkDuplicate (zope.configuration.config.ConfigurationContext)
Failed doctest test for
zope.configuration.config.ConfigurationContext.checkDuplicate
  File "src/zope/configuration/config.py", line 256, in checkDuplicate

----------------------------------------------------------------------
File "src/zope/configuration/config.py", line 278, in
zope.configuration.config.ConfigurationContext.checkDuplicate
Failed example:
    try:
      c.checkDuplicate(d + os.path.normpath('/bar.zcml'))
    except ConfigurationError, e:
      str(e).endswith("bar.zcml' included more than once")
Expected:
    True
Got nothing



Failure in test path (zope.configuration.config.ConfigurationContext)
Failed doctest test for zope.configuration.config.ConfigurationContext.path
  File "src/zope/configuration/config.py", line 212, in path

----------------------------------------------------------------------
File "src/zope/configuration/config.py", line 227, in
zope.configuration.config.ConfigurationContext.path
Failed example:
    c.path("y/z") == d + os.path.normpath("/y/z")
Expected:
    1
Got:
    False
----------------------------------------------------------------------
File "src/zope/configuration/config.py", line 229, in
zope.configuration.config.ConfigurationContext.path
Failed example:
    c.path("y/./z") == d + os.path.normpath("/y/z")
Expected:
    1
Got:
    False
----------------------------------------------------------------------
File "src/zope/configuration/config.py", line 231, in
zope.configuration.config.ConfigurationContext.path
Failed example:
    c.path("y/../z") == d + os.path.normpath("/z")
Expected:
    1
Got:
    False

In test.py of Zope3 we insert abosolute path at the beginning of path.
But for individual packages we use relative path.
Here is relevant code from test.py of Zope 3:

  here = os.path.abspath(os.path.dirname(sys.argv[0]))
  src = os.path.join(here, 'src')
  sys.path.insert(0, src)

And from test.py of an individual package:

  src = os.path.join(os.path.split(sys.argv[0])[0], 'src')
  sys.path.insert(0, src)

So, can I change the all the invidual pacakge's test.py to insert absolute path?
or only the test.py file of zope.configuration (test.py is not yet added)

Regards,
Baiju M

[1] ftp://ftp.berlios.de/pub/zissue/z3/


More information about the Zope3-dev mailing list