[Zope-Checkins] CVS: Zope/lib/python/Zope/Startup/tests - test_schema.py:1.5.8.2
Chris McDonough
chrism@zope.com
Mon, 21 Jul 2003 17:10:04 -0400
Update of /cvs-repository/Zope/lib/python/Zope/Startup/tests
In directory cvs.zope.org:/tmp/cvs-serv29670
Modified Files:
Tag: Zope-2_7-branch
test_schema.py
Log Message:
Merge from HEAD (fix failing tests which depended on getSchema being importable from Startup).
=== Zope/lib/python/Zope/Startup/tests/test_schema.py 1.5.8.1 => 1.5.8.2 ===
--- Zope/lib/python/Zope/Startup/tests/test_schema.py:1.5.8.1 Tue Jul 8 01:28:49 2003
+++ Zope/lib/python/Zope/Startup/tests/test_schema.py Mon Jul 21 17:09:59 2003
@@ -30,14 +30,26 @@
TEMPNAME = tempfile.mktemp()
TEMPPRODUCTS = os.path.join(TEMPNAME, "Products")
+try:
+ __file__
+except NameError:
+ import sys
+ __file__ = sys.argv[0]
+def getSchema():
+ startup = os.path.dirname(os.path.dirname(__file__))
+ schemafile = os.path.join(startup, 'zopeschema.xml')
+ return ZConfig.loadSchema(schemafile)
+
class StartupTestCase(unittest.TestCase):
+ def setUp(self):
+ self.schema = getSchema()
def load_config_text(self, text):
# We have to create a directory of our own since the existence
# of the directory is checked. This handles this in a
# platform-independent way.
- schema = Zope.Startup.getSchema()
+ schema = self.schema
sio = cStringIO.StringIO(
text.replace("<<INSTANCE_HOME>>", TEMPNAME))
os.mkdir(TEMPNAME)
@@ -51,7 +63,7 @@
return conf
def test_load_config_template(self):
- schema = Zope.Startup.getSchema()
+ schema = self.schema
cfg = getConfiguration()
fn = os.path.join(cfg.zopehome, "skel", "etc", "zope.conf.in")
f = open(fn)