[py-svn] r45849 - in py/branch/session-cleanups/py/test: . rsession rsession/webdata
fijal at codespeak.net
fijal at codespeak.net
Sat Aug 18 14:59:19 CEST 2007
Author: fijal
Date: Sat Aug 18 14:59:18 2007
New Revision: 45849
Modified:
py/branch/session-cleanups/py/test/reporter.py
py/branch/session-cleanups/py/test/rsession/rsession.py
py/branch/session-cleanups/py/test/rsession/web.py
py/branch/session-cleanups/py/test/rsession/webdata/source.js
Log:
A minor simplification how to finish off the web server (web stuff
needs refactoring anyway)
Modified: py/branch/session-cleanups/py/test/reporter.py
==============================================================================
--- py/branch/session-cleanups/py/test/reporter.py (original)
+++ py/branch/session-cleanups/py/test/reporter.py Sat Aug 18 14:59:18 2007
@@ -14,7 +14,7 @@
from py.__.test.representation import Presenter
import sys
-import thread
+import thread
class AbstractReporter(object):
def __init__(self, config, hosts):
Modified: py/branch/session-cleanups/py/test/rsession/rsession.py
==============================================================================
--- py/branch/session-cleanups/py/test/rsession/rsession.py (original)
+++ py/branch/session-cleanups/py/test/rsession/rsession.py Sat Aug 18 14:59:18 2007
@@ -64,18 +64,9 @@
else:
reporter_instance = reporter_class(self.config, hosts)
reporter = reporter_instance.report
- else:
- startserverflag = False
- return reporter, startserverflag
+ return reporter
- def kill_server(self, startserverflag):
- """ Kill web server
- """
- if startserverflag:
- from py.__.test.rsession.web import kill_server
- kill_server()
-
def wrap_reporter(self, reporter):
""" We wrap reporter around, which makes it possible to us to track
existance of failures
@@ -122,7 +113,7 @@
args = self.config.args
hm = HostManager(self.config)
- reporter, startserverflag = self.init_reporter(reporter,
+ reporter = self.init_reporter(reporter,
hm.hosts, RemoteReporter)
reporter, checkfun = self.wrap_reporter(reporter)
@@ -147,15 +138,12 @@
exitfirst=self.config.option.exitfirst)
reporter(repevent.Nodes(nodes))
retval = reporter(repevent.TestFinished())
- self.kill_server(startserverflag)
return retval
except (KeyboardInterrupt, SystemExit):
reporter(repevent.InterruptedExecution())
- self.kill_server(startserverflag)
raise
except:
reporter(repevent.CrashedExecution())
- self.kill_server(startserverflag)
raise
def dispatch_tests(self, nodes, reporter, checkfun):
@@ -176,7 +164,7 @@
if not self.config.option.nomagic:
py.magic.invoke(assertion=1)
- reporter, startserverflag = self.init_reporter(reporter,
+ reporter = self.init_reporter(reporter,
hosts, LocalReporter, args[0])
reporter, checkfun = self.wrap_reporter(reporter)
@@ -193,7 +181,6 @@
local_loop(self, reporter, itemgenerator, checkfun, self.config, runner=runner)
retval = reporter(repevent.TestFinished())
- self.kill_server(startserverflag)
if not self.config.option.nomagic:
py.magic.revoke(assertion=1)
Modified: py/branch/session-cleanups/py/test/rsession/web.py
==============================================================================
--- py/branch/session-cleanups/py/test/rsession/web.py (original)
+++ py/branch/session-cleanups/py/test/rsession/web.py Sat Aug 18 14:59:18 2007
@@ -305,9 +305,8 @@
if not self.to_rsync[item.host]:
self._host_ready(item)
-
def report_TestStarted(self, event):
- # XXX: It overrides out self.hosts
+ # XXX: It overrides our self.hosts
self.hosts = {}
self.ready_hosts = {}
for host in event.hosts:
@@ -315,6 +314,13 @@
self.ready_hosts[host] = False
self.start_event.set()
self.pending_events.put(event)
+
+ def report_TestFinished(self, event):
+ self.pending_events.put(event)
+ kill_server()
+
+ report_InterruptedExecution = report_TestFinished
+ report_CrashedExecution = report_TestFinished
def report(self, what):
repfun = getattr(self, "report_" + what.__class__.__name__,
@@ -330,13 +336,6 @@
print str(i)[2:-1]
print excinfo
-## try:
-## self.wait_flag.acquire()
-## self.pending_events.insert(0, event)
-## self.wait_flag.notify()
-## finally:
-## self.wait_flag.release()
-
exported_methods = ExportedMethods()
class TestHandler(BaseHTTPRequestHandler):
Modified: py/branch/session-cleanups/py/test/rsession/webdata/source.js
==============================================================================
Binary files. No diff available.
More information about the pytest-commit
mailing list