[Zope3-checkins]
SVN: Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/
checkpoint some code before I rework it
Benji York
benji at zope.com
Sun Jul 23 22:35:44 EDT 2006
Log message for revision 69247:
checkpoint some code before I rework it
Changed:
U Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/app/server/main.py
A Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/testbrowser/ftests/real.zcml
U Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/testbrowser/ftests/reallayer.py
U Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/testbrowser/real.txt
U Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/testbrowser/utilities.py
-=-
Modified: Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/app/server/main.py
===================================================================
--- Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/app/server/main.py 2006-07-24 01:27:17 UTC (rev 69246)
+++ Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/app/server/main.py 2006-07-24 02:35:43 UTC (rev 69247)
@@ -71,9 +71,15 @@
return db
-def run():
+def run(timeout=None):
+ # if a timeout is provided, pass it on
+ if timeout is not None:
+ args = [timeout]
+ else:
+ args = []
+
try:
- ThreadedAsync.loop()
+ ThreadedAsync.loop(*args)
except KeyboardInterrupt:
# Exit without spewing an exception.
pass
Added: Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/testbrowser/ftests/real.zcml
===================================================================
--- Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/testbrowser/ftests/real.zcml 2006-07-24 01:27:17 UTC (rev 69246)
+++ Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/testbrowser/ftests/real.zcml 2006-07-24 02:35:43 UTC (rev 69247)
@@ -0,0 +1,62 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:meta="http://namespaces.zope.org/meta"
+ i18n_domain="zope"
+ >
+
+ <!-- Turn on the devmode -->
+ <meta:provides feature="devmode" />
+
+ <!-- This file is the equivalent of site.zcml and it is -->
+ <!-- used for functional testing setup -->
+
+ <include package="zope.app" />
+ <include package="zope.app" file="ftesting.zcml" />
+
+ <include files="zopeskel/etc/package-includes/*-meta.zcml" />
+ <include files="zopeskel/etc/package-includes/*-configure.zcml" />
+ <include files="zopeskel/etc/package-includes/*-ftesting.zcml" />
+
+ <include file="securitypolicy.zcml" />
+ <include file="securitypolicy-ftesting.zcml" />
+
+ <!-- Principals -->
+
+ <unauthenticatedPrincipal
+ id="zope.anybody"
+ title="Unauthenticated User" />
+
+ <unauthenticatedGroup
+ id="zope.Anybody"
+ title="Unauthenticated Users"
+ />
+
+ <authenticatedGroup
+ id="zope.Authenticated"
+ title="Authenticated Users"
+ />
+
+ <everybodyGroup
+ id="zope.Everybody"
+ title="All Users"
+ />
+
+ <!-- Principal that tests generally run as -->
+ <principal
+ id="zope.mgr"
+ title="Manager"
+ login="mgr"
+ password="mgrpw" />
+
+ <!-- Bootstrap principal used to make local grant to the principal above -->
+ <principal
+ id="zope.globalmgr"
+ title="Manager"
+ login="globalmgr"
+ password="globalmgrpw" />
+
+ <grant role="zope.Manager" principal="zope.globalmgr" />
+
+ <includeOverrides file="overrides_ftesting.zcml" />
+
+</configure>
Property changes on: Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/testbrowser/ftests/real.zcml
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/testbrowser/ftests/reallayer.py
===================================================================
--- Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/testbrowser/ftests/reallayer.py 2006-07-24 01:27:17 UTC (rev 69246)
+++ Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/testbrowser/ftests/reallayer.py 2006-07-24 02:35:43 UTC (rev 69247)
@@ -1,8 +1,31 @@
from zope.app.server.main import setup, load_options, run
+from zope.testbrowser import realproxy
import ThreadedAsync.LoopCallback
+import os
+import tempfile
import threading
-from zope.testbrowser.realproxy import TARGET_PORT
+CONF = """\
+site-definition %(SITE_ZCML)s
+
+<server http>
+ type HTTP
+ address 127.0.0.1:%(TARGET_PORT)s
+</server>
+
+<zodb>
+ <demostorage>
+ </demostorage>
+</zodb>
+
+<accesslog>
+</accesslog>
+
+<eventlog>
+</eventlog>
+"""
+
+
class TestbrowserRealClass:
__bases__ = ()
@@ -19,12 +42,19 @@
def startZope(self, fg=None):
"""start Zope in a daemon thread"""
+ SITE_ZCML = '/home/benji/workspace/testbrowser3/src/zope/testbrowser/ftests/real.zcml'
+ TARGET_PORT = realproxy.TARGET_PORT
+ handle, self.conf_path = tempfile.mkstemp()
+ os.write(handle, CONF % locals())
+ os.close(handle)
+
def go():
- # force the server to run on a known port
+ # force the server to run with a known config
+# args = ['-C', self.conf_path]
args = ['-X', 'server/address=%s' % TARGET_PORT,
'-X', 'site-definition=ftesting.zcml']
setup(load_options(args))
- run()
+ run(timeout=1.0)
self.zope_thread = threading.Thread(target=go)
self.zope_thread.setDaemon(True)
@@ -32,7 +62,9 @@
def stopZope(self):
"""tell Zope to stop and wait for it to do so"""
+ import time; time.sleep(1)
ThreadedAsync.LoopCallback.exit_status = 0
self.zope_thread.join()
+ os.remove(self.conf_path)
TestbrowserReal = TestbrowserRealClass()
Modified: Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/testbrowser/real.txt
===================================================================
--- Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/testbrowser/real.txt 2006-07-24 01:27:17 UTC (rev 69246)
+++ Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/testbrowser/real.txt 2006-07-24 02:35:43 UTC (rev 69247)
@@ -14,6 +14,9 @@
>>> browser.contents
u'...</head>...'
+ >>> browser.contents
+ u'...[top]...'
+
>>> browser.getLink('[top]', index=0)
<Link text='[top]' url=u'http://localhost:23123/@@SelectedManagementView.html'>
Modified: Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/testbrowser/utilities.py
===================================================================
--- Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/testbrowser/utilities.py 2006-07-24 01:27:17 UTC (rev 69246)
+++ Zope3/branches/benji-testbrowser-with-real-browsers/src/zope/testbrowser/utilities.py 2006-07-24 02:35:43 UTC (rev 69247)
@@ -20,6 +20,7 @@
import re
import sys
import time
+from test import pystone
class AmbiguityError(KeyError):
pass
More information about the Zope3-Checkins
mailing list