From fijal at codespeak.net Wed Jan 3 17:06:21 2007
From: fijal at codespeak.net (fijal at codespeak.net)
Date: Wed, 3 Jan 2007 17:06:21 +0100 (CET)
Subject: [py-svn] r36123 - in py/dist/py/test/rsession: . webdata
Message-ID: <20070103160621.5837210068@code0.codespeak.net>
Author: fijal
Date: Wed Jan 3 17:06:18 2007
New Revision: 36123
Modified:
py/dist/py/test/rsession/webdata/source.js
py/dist/py/test/rsession/webjs.py
Log:
Adhere to new API.
Modified: py/dist/py/test/rsession/webdata/source.js
==============================================================================
Binary files. No diff available.
Modified: py/dist/py/test/rsession/webjs.py
==============================================================================
--- py/dist/py/test/rsession/webjs.py (original)
+++ py/dist/py/test/rsession/webjs.py Wed Jan 3 17:06:18 2007
@@ -12,13 +12,13 @@
py.test.skip("PyPy not found")
def create_elem(s):
- return dom.get_document().createElement(s)
+ return dom.document.createElement(s)
def get_elem(el):
- return dom.get_document().getElementById(el)
+ return dom.document.getElementById(el)
def create_text_elem(txt):
- return dom.get_document().createTextNode(txt)
+ return dom.document.createTextNode(txt)
tracebacks = {}
skips = {}
@@ -49,7 +49,7 @@
exported_methods.show_all_statuses(glob.sessid, comeback)
def show_info(data="aa"):
- info = dom.get_document().getElementById("info")
+ info = dom.document.getElementById("info")
info.style.visibility = "visible"
while len(info.childNodes):
info.removeChild(info.childNodes[0])
@@ -59,7 +59,7 @@
# XXX: Need guido
def hide_info():
- info = dom.get_document().getElementById("info")
+ info = dom.document.getElementById("info")
info.style.visibility = "hidden"
def make_module_box(msg):
@@ -88,7 +88,7 @@
def add_received_item_outcome(msg, module_part):
if msg['hostkey']:
- host_elem = dom.get_document().getElementById(msg['hostkey'])
+ host_elem = dom.document.getElementById(msg['hostkey'])
glob.host_pending[msg['hostkey']].pop()
count = len(glob.host_pending[msg['hostkey']])
host_elem.childNodes[0].nodeValue = '%s[%s]' % (
@@ -135,23 +135,23 @@
def process(msg):
if len(msg) == 0:
return False
- elem = dom.get_document().getElementById("testmain")
+ elem = dom.document.getElementById("testmain")
#elem.innerHTML += '%s
' % msg['event']
- main_t = dom.get_document().getElementById("main_table")
+ main_t = dom.document.getElementById("main_table")
if msg['type'] == 'ItemStart':
# we start a new directory or what
if msg['itemtype'] == 'Module':
tr = make_module_box(msg)
main_t.appendChild(tr)
elif msg['type'] == 'SendItem':
- host_elem = dom.get_document().getElementById(msg['hostkey'])
+ host_elem = dom.document.getElementById(msg['hostkey'])
glob.host_pending[msg['hostkey']].insert(0, msg['fullitemname'])
count = len(glob.host_pending[msg['hostkey']])
host_elem.childNodes[0].nodeValue = '%s[%s]' % (
glob.host_dict[msg['hostkey']], count)
elif msg['type'] == 'HostReady':
- host_elem = dom.get_document().getElementById(msg['hostkey'])
+ host_elem = dom.document.getElementById(msg['hostkey'])
host_elem.style.background = \
"#00ff00"
host_elem.childNodes[0].nodeValue = '%s[0]' % (
@@ -165,8 +165,8 @@
add_received_item_outcome(msg, module_part)
elif msg['type'] == 'TestFinished':
text = "FINISHED %s run, %s failures, %s skipped" % (msg['run'], msg['fails'], msg['skips'])
- dom.get_document().title = "Py.test %s" % text
- dom.get_document().getElementById("Tests").childNodes[0].nodeValue = \
+ dom.document.title = "Py.test %s" % text
+ dom.document.getElementById("Tests").childNodes[0].nodeValue = \
"Tests [%s]" % text
elif msg['type'] == 'FailedTryiter':
module_part = get_elem(msg['fullitemname'])
@@ -191,7 +191,7 @@
tr.appendChild(td)
module_part.appendChild(tr)
if glob.data_empty:
- mbox = dom.get_document().getElementById('messagebox')
+ mbox = dom.document.getElementById('messagebox')
mbox.parentNode.scrollIntoView()
return True
@@ -206,7 +206,7 @@
txt = create_text_elem(item_name + "\n" + data)
pre.appendChild(txt)
msgbox.appendChild(pre)
- dom.get_document().location = "#message"
+ dom.document.location = "#message"
glob.data_empty = False
def show_traceback(item_name="aa"):
@@ -227,7 +227,7 @@
show_host(glob.host)
def show_host(host_name="aa"):
- elem = dom.get_document().getElementById("jobs")
+ elem = dom.document.getElementById("jobs")
while len(elem.childNodes):
elem.removeChild(elem.childNodes[0])
for item in glob.host_pending[host_name]:
@@ -241,14 +241,14 @@
dom.setTimeout(reshow_host, 100)
def hide_host():
- elem = dom.get_document().getElementById("jobs")
+ elem = dom.document.getElementById("jobs")
while len(elem.childNodes):
elem.removeChild(elem.childNodes[0])
elem.style.visibility = "hidden"
glob.host = ""
def host_init(host_dict):
- tbody = dom.get_document().getElementById("hostsbody")
+ tbody = dom.document.getElementById("hostsbody")
for host in host_dict.keys():
tr = create_elem('tr')
tbody.appendChild(tr)
From fijal at codespeak.net Wed Jan 3 19:27:30 2007
From: fijal at codespeak.net (fijal at codespeak.net)
Date: Wed, 3 Jan 2007 19:27:30 +0100 (CET)
Subject: [py-svn] r36129 - py/dist/py/path/svn/testing
Message-ID: <20070103182730.7D32310082@code0.codespeak.net>
Author: fijal
Date: Wed Jan 3 19:27:28 2007
New Revision: 36129
Modified:
py/dist/py/path/svn/testing/test_urlcommand.py
Log:
Fix a test
Modified: py/dist/py/path/svn/testing/test_urlcommand.py
==============================================================================
--- py/dist/py/path/svn/testing/test_urlcommand.py (original)
+++ py/dist/py/path/svn/testing/test_urlcommand.py Wed Jan 3 19:27:28 2007
@@ -68,7 +68,7 @@
assert info.last_author == 'hpk'
assert info.created_rev == 2256
assert info.kind == 'file'
- assert time.gmtime(info.mtime)[:6] == (now.year, 11, 24, 17, 55, 0)
+ assert time.gmtime(info.mtime)[:6] == (2006, 11, 24, 17, 55, 0)
assert info.size == 165
assert info.time == info.mtime * 1000000
From fijal at codespeak.net Wed Jan 3 20:17:44 2007
From: fijal at codespeak.net (fijal at codespeak.net)
Date: Wed, 3 Jan 2007 20:17:44 +0100 (CET)
Subject: [py-svn] r36131 - in py/dist/py/test: . testing
Message-ID: <20070103191744.BEC8110072@code0.codespeak.net>
Author: fijal
Date: Wed Jan 3 20:17:40 2007
New Revision: 36131
Modified:
py/dist/py/test/collect.py
py/dist/py/test/testing/test_collect.py
Log:
Add __hash__ for items and test for it
Modified: py/dist/py/test/collect.py
==============================================================================
--- py/dist/py/test/collect.py (original)
+++ py/dist/py/test/collect.py Wed Jan 3 20:17:40 2007
@@ -102,6 +102,9 @@
except AttributeError:
return False
+ def __hash__(self):
+ return hash((self.name, self.parent))
+
def __ne__(self, other):
return not self == other
Modified: py/dist/py/test/testing/test_collect.py
==============================================================================
--- py/dist/py/test/testing/test_collect.py (original)
+++ py/dist/py/test/testing/test_collect.py Wed Jan 3 20:17:40 2007
@@ -410,3 +410,30 @@
l = list(col.tryiter(reporterror=errors.append))
assert len(errors) == 0
+def test_check_collect_hashes():
+ tmp = py.test.ensuretemp("check_collect_hashes")
+ tmp.ensure("test_one.py").write(py.code.Source("""
+ def test_1():
+ pass
+
+ def test_2():
+ pass
+ """))
+ tmp.ensure("test_two.py").write(py.code.Source("""
+ def test_1():
+ pass
+
+ def test_2():
+ pass
+ """))
+ tmp.ensure("__init__.py")
+ col = py.test.collect.Directory(tmp)
+ errors = []
+ l = list(col.tryiter(reporterror=errors.append))
+ #assert len(errors) == 0
+ assert len(l) == 4
+ for numi, i in enumerate(l):
+ for numj, j in enumerate(l):
+ if numj != numi:
+ assert hash(i) != hash(j)
+ assert i != j
From fijal at codespeak.net Wed Jan 3 20:20:42 2007
From: fijal at codespeak.net (fijal at codespeak.net)
Date: Wed, 3 Jan 2007 20:20:42 +0100 (CET)
Subject: [py-svn] r36132 - py/dist/py/test/testing
Message-ID: <20070103192042.7B7D110072@code0.codespeak.net>
Author: fijal
Date: Wed Jan 3 20:20:40 2007
New Revision: 36132
Modified:
py/dist/py/test/testing/test_collect.py
Log:
Remove unnecessary code
Modified: py/dist/py/test/testing/test_collect.py
==============================================================================
--- py/dist/py/test/testing/test_collect.py (original)
+++ py/dist/py/test/testing/test_collect.py Wed Jan 3 20:20:40 2007
@@ -428,9 +428,7 @@
"""))
tmp.ensure("__init__.py")
col = py.test.collect.Directory(tmp)
- errors = []
- l = list(col.tryiter(reporterror=errors.append))
- #assert len(errors) == 0
+ l = list(col.tryiter())
assert len(l) == 4
for numi, i in enumerate(l):
for numj, j in enumerate(l):
From fijal at codespeak.net Thu Jan 4 09:49:39 2007
From: fijal at codespeak.net (fijal at codespeak.net)
Date: Thu, 4 Jan 2007 09:49:39 +0100 (CET)
Subject: [py-svn] r36138 - in py/dist/py/test/rsession: . testing
Message-ID: <20070104084939.D9B4910070@code0.codespeak.net>
Author: fijal
Date: Thu Jan 4 09:49:34 2007
New Revision: 36138
Modified:
py/dist/py/test/rsession/master.py
py/dist/py/test/rsession/reporter.py
py/dist/py/test/rsession/rsession.py
py/dist/py/test/rsession/testing/test_boxing.py
py/dist/py/test/rsession/testing/test_master.py
py/dist/py/test/rsession/testing/test_rsession.py
Log:
Added check if test was not actually reported. This is intermediate checkin, because it does nothing actually.
Modified: py/dist/py/test/rsession/master.py
==============================================================================
--- py/dist/py/test/rsession/master.py (original)
+++ py/dist/py/test/rsession/master.py Thu Jan 4 09:49:34 2007
@@ -6,15 +6,21 @@
from py.__.test.rsession import report
class MasterNode(object):
- def __init__(self, channel, reporter):
+ def __init__(self, channel, reporter, done_dict):
self.channel = channel
self.reporter = reporter
- channel.setcallback(self.receive_result)
+
+ def callback(outcome):
+ #import pdb;pdb.set_trace()
+ item = self.pending.pop()
+ if not item in done_dict:
+ self.receive_result(outcome, item)
+ done_dict[item] = True
+ channel.setcallback(callback)
self.pending = []
- def receive_result(self, outcomestring):
+ def receive_result(self, outcomestring, item):
repr_outcome = ReprOutcome(outcomestring)
- item = self.pending.pop()
# send finish report
self.reporter(report.ReceivedItemOutcome(
self.channel, item, repr_outcome))
@@ -48,7 +54,6 @@
break
waiter()
-
def setup_slave(gateway, pkgpath, options):
from py.__.test.rsession import slave
import os
Modified: py/dist/py/test/rsession/reporter.py
==============================================================================
--- py/dist/py/test/rsession/reporter.py (original)
+++ py/dist/py/test/rsession/reporter.py Thu Jan 4 09:49:34 2007
@@ -2,9 +2,7 @@
""" reporter - different reporter for different purposes ;-)
Still lacks:
- 1. Reporting of Failed to load module inside the module
- 2. Tests for remote reporter
- 3. Hanging nodes are not good done
+ 1. Hanging nodes are not good done
"""
import py
Modified: py/dist/py/test/rsession/rsession.py
==============================================================================
--- py/dist/py/test/rsession/rsession.py (original)
+++ py/dist/py/test/rsession/rsession.py Thu Jan 4 09:49:34 2007
@@ -203,14 +203,16 @@
yield y
itemgenerator = itemgen()
- dispatch_loop(nodes, itemgenerator, checkfun)
- teardown_hosts(reporter, [node.channel for node in nodes], nodes,
- exitfirst=self.config.option.exitfirst)
+ try:
+ dispatch_loop(nodes, itemgenerator, checkfun)
+ finally:
+ teardown_hosts(reporter, [node.channel for node in nodes], nodes,
+ exitfirst=self.config.option.exitfirst)
+ if startserverflag:
+ from py.__.test.rsession.web import kill_server
+ kill_server()
reporter(report.Nodes(nodes))
retval = reporter(report.TestFinished())
- if startserverflag:
- from py.__.test.rsession.web import kill_server
- kill_server()
return retval
class LSession(AbstractSession):
Modified: py/dist/py/test/rsession/testing/test_boxing.py
==============================================================================
--- py/dist/py/test/rsession/testing/test_boxing.py (original)
+++ py/dist/py/test/rsession/testing/test_boxing.py Thu Jan 4 09:49:34 2007
@@ -92,4 +92,3 @@
os.kill(pid, 15)
par(pid)
assert b.signal == 15
-
Modified: py/dist/py/test/rsession/testing/test_master.py
==============================================================================
--- py/dist/py/test/rsession/testing/test_master.py (original)
+++ py/dist/py/test/rsession/testing/test_master.py Thu Jan 4 09:49:34 2007
@@ -42,7 +42,7 @@
ch = DummyChannel()
reportlist = []
- mnode = MasterNode(ch, reportlist.append)
+ mnode = MasterNode(ch, reportlist.append, {})
mnode.send(py.test.Item("ok"))
mnode.send(py.test.Item("notok"))
ch.callback(Outcome().make_repr())
@@ -53,6 +53,16 @@
assert received[0].outcome.passed
assert not received[1].outcome.passed
+def test_unique_nodes():
+ ch = DummyChannel()
+ reportlist = []
+ mnode = MasterNode(ch, reportlist.append, {})
+ mnode.send(py.test.Item("ok"))
+ mnode.send(py.test.Item("ok"))
+ ch.callback(Outcome().make_repr())
+ ch.callback(Outcome().make_repr())
+ assert len(reportlist) == 3
+
def test_outcome_repr():
out = ReprOutcome(Outcome(skipped=True).make_repr())
s = repr(out)
@@ -97,7 +107,7 @@
def open_gw():
gw = py.execnet.PopenGateway()
channel = setup_slave(gw, pkgdir, remote_options.d)
- mn = MasterNode(channel, simple_report)
+ mn = MasterNode(channel, simple_report, {})
return mn
master_nodes = [open_gw(), open_gw(), open_gw()]
Modified: py/dist/py/test/rsession/testing/test_rsession.py
==============================================================================
--- py/dist/py/test/rsession/testing/test_rsession.py (original)
+++ py/dist/py/test/rsession/testing/test_rsession.py Thu Jan 4 09:49:34 2007
@@ -165,6 +165,7 @@
passevents = [i for i in testevents if i.outcome.passed]
failevents = [i for i in testevents if i.outcome.excinfo]
skippedevents = [i for i in testevents if i.outcome.skipped]
+ assert len(testevents) == 4
assert len(passevents) == 1
assert len(failevents) == 3
tb = failevents[0].outcome.excinfo.traceback
From fijal at codespeak.net Thu Jan 4 09:52:34 2007
From: fijal at codespeak.net (fijal at codespeak.net)
Date: Thu, 4 Jan 2007 09:52:34 +0100 (CET)
Subject: [py-svn] r36139 - py/dist/py/test/rsession
Message-ID: <20070104085234.9259D10070@code0.codespeak.net>
Author: fijal
Date: Thu Jan 4 09:52:33 2007
New Revision: 36139
Modified:
py/dist/py/test/rsession/hostmanage.py
Log:
Forgotten to check that one in
Modified: py/dist/py/test/rsession/hostmanage.py
==============================================================================
--- py/dist/py/test/rsession/hostmanage.py (original)
+++ py/dist/py/test/rsession/hostmanage.py Thu Jan 4 09:52:33 2007
@@ -63,10 +63,12 @@
hosts.append((num, host, gw, str(pkgdir.dirpath())))
return hosts
-# XXX: Options has grown a bit too much, but most of them is just for tests
+# XXX: Options has grown a bit too much, but most of them are just for tests
def init_hosts(reporter, sshhosts, relpath, pkgdir, rsync_roots=None, \
remote_python=None, remote_options={}, optimise_localhost=True,\
- do_sync=True):
+ do_sync=True, done_dict=None):
+ if done_dict is None:
+ done_dict = {}
assert pkgdir.join("__init__.py").check(), (
"%s probably wrong" %(pkgdir,))
assert relpath, relpath
@@ -98,14 +100,14 @@
rsync.send(pkgdir.dirpath())
# hosts ready
- return setup_nodes(hosts, pkgdir, remote_options, reporter)
+ return setup_nodes(hosts, pkgdir, remote_options, reporter, done_dict)
-def setup_nodes(hosts, pkgdir, remote_options, reporter):
+def setup_nodes(hosts, pkgdir, remote_options, reporter, done_dict):
nodes = []
for num, host, gw, remoterootpath in hosts:
ch = setup_slave(gw, os.path.join(remoterootpath, pkgdir.basename),
remote_options)
- nodes.append(MasterNode(ch, reporter))
+ nodes.append(MasterNode(ch, reporter, done_dict))
return nodes
From fijal at codespeak.net Thu Jan 4 11:18:13 2007
From: fijal at codespeak.net (fijal at codespeak.net)
Date: Thu, 4 Jan 2007 11:18:13 +0100 (CET)
Subject: [py-svn] r36141 - py/dist/py/test/rsession/testing
Message-ID: <20070104101813.9F7A110070@code0.codespeak.net>
Author: fijal
Date: Thu Jan 4 11:18:06 2007
New Revision: 36141
Modified:
py/dist/py/test/rsession/testing/test_webjs.py
Log:
Fixed tests to new pypy.js api.
Modified: py/dist/py/test/rsession/testing/test_webjs.py
==============================================================================
--- py/dist/py/test/rsession/testing/test_webjs.py (original)
+++ py/dist/py/test/rsession/testing/test_webjs.py Thu Jan 4 11:18:06 2007
@@ -13,6 +13,7 @@
from pypy.translator.js.modules import dom
mod.dom = dom
dom.window = dom.Window(html)
+ dom.document = dom.window.document
config, args = py.test.Config.parse([])
from py.__.test.rsession.rsession import session_options
session_options.bind_config(config)
@@ -120,5 +121,5 @@
webjs.process(msg)
schedule_callbacks(exported_methods)
# ouch
- assert dom.get_document().getElementById('modules/foo.py').childNodes[1].\
+ assert dom.document.getElementById('modules/foo.py').childNodes[1].\
childNodes[0].childNodes[0].childNodes[0].nodeValue == 'F'
From fijal at codespeak.net Mon Jan 8 10:09:17 2007
From: fijal at codespeak.net (fijal at codespeak.net)
Date: Mon, 8 Jan 2007 10:09:17 +0100 (CET)
Subject: [py-svn] r36221 - in py/dist/py/test/rsession: . testing
Message-ID: <20070108090917.5DD4A10071@code0.codespeak.net>
Author: fijal
Date: Mon Jan 8 10:09:11 2007
New Revision: 36221
Modified:
py/dist/py/test/rsession/hostmanage.py
py/dist/py/test/rsession/master.py
py/dist/py/test/rsession/rsession.py
py/dist/py/test/rsession/testing/test_master.py
py/dist/py/test/rsession/testing/test_rsession.py
py/dist/py/test/rsession/web.py
Log:
Added rescheduling of tests when there are empty hosts.
Modified: py/dist/py/test/rsession/hostmanage.py
==============================================================================
--- py/dist/py/test/rsession/hostmanage.py (original)
+++ py/dist/py/test/rsession/hostmanage.py Mon Jan 8 10:09:11 2007
@@ -3,7 +3,7 @@
import time
import thread, threading
from py.__.test.rsession.master import \
- setup_slave, MasterNode, dispatch_loop
+ setup_slave, MasterNode
from py.__.test.rsession import report
from py.__.test.rsession.rsync import RSync
Modified: py/dist/py/test/rsession/master.py
==============================================================================
--- py/dist/py/test/rsession/master.py (original)
+++ py/dist/py/test/rsession/master.py Mon Jan 8 10:09:11 2007
@@ -35,24 +35,47 @@
# send start report
self.reporter(report.SendItem(self.channel, item))
+def itemgen(colitems, reporter, keyword, reporterror):
+ for x in colitems:
+ for y in x.tryiter(reporterror = lambda x: reporterror(reporter, x), keyword = keyword):
+ yield y
+
+def randomgen(items, done_dict):
+ """ Generator, which randomly gets all the tests from items as long
+ as they're not in done_dict
+ """
+ import random
+ while items:
+ values = items.keys()
+ item = values[int(random.random()*len(values))]
+ if item in done_dict:
+ del items[item]
+ else:
+ yield item
+
def dispatch_loop(masternodes, itemgenerator, shouldstop,
- waiter = lambda: py.std.time.sleep(0.1)):
- from py.__.test.rsession.rsession import session_options
+ waiter = lambda: py.std.time.sleep(0.1),
+ max_tasks_per_node=None):
+ if not max_tasks_per_node:
+ from py.__.test.rsession.rsession import session_options
- max_tasks_per_node = session_options.max_tasks_per_node
+ max_tasks_per_node = session_options.max_tasks_per_node
+ all_tests = {}
while 1:
try:
for node in masternodes:
if len(node.pending) < max_tasks_per_node:
item = itemgenerator.next()
+ all_tests[item] = True
if shouldstop():
for _node in masternodes:
_node.send(StopIteration) # magic connector
- return
+ return None
node.send(item)
except StopIteration:
break
waiter()
+ return all_tests
def setup_slave(gateway, pkgpath, options):
from py.__.test.rsession import slave
Modified: py/dist/py/test/rsession/rsession.py
==============================================================================
--- py/dist/py/test/rsession/rsession.py (original)
+++ py/dist/py/test/rsession/rsession.py Mon Jan 8 10:09:11 2007
@@ -10,7 +10,7 @@
from py.__.test.rsession import report
from py.__.test.rsession.master import \
- setup_slave, MasterNode, dispatch_loop
+ setup_slave, MasterNode, dispatch_loop, itemgen, randomgen
from py.__.test.rsession.hostmanage import init_hosts, teardown_hosts
from py.__.test.rsession.local import local_loop, plain_runner, apigen_runner,\
@@ -168,7 +168,7 @@
class RSession(AbstractSession):
""" Remote version of session
"""
- def main(self, args, reporter=None):
+ def main(self, args, reporter=None, override_checkfun=None):
""" main loop for running tests. """
if not args:
args = [py.path.local()]
@@ -182,6 +182,8 @@
session_options.bind_config(self.config)
reporter, checkfun, startserverflag = self.init_reporter(reporter,
sshhosts, RemoteReporter)
+ if override_checkfun:
+ checkfun = override_checkfun
reporter(report.TestStarted(sshhosts))
pkgdir = self.getpkgdir(args[0])
colitems = self.make_colitems(args, baseon=pkgdir.dirpath())
@@ -190,21 +192,24 @@
except:
remotepython = None
+ done_dict = {}
nodes = init_hosts(reporter, sshhosts, directories, pkgdir,
rsync_roots, remotepython, remote_options=remote_options.d,
- optimise_localhost=self.optimise_localhost)
+ optimise_localhost=self.optimise_localhost, done_dict=done_dict)
reporter(report.RsyncFinished())
keyword = self.config.option.keyword
-
- def itemgen():
- for x in colitems:
- for y in x.tryiter(reporterror = lambda x: self.reporterror(reporter, x), keyword = keyword):
- yield y
- itemgenerator = itemgen()
+ itemgenerator = itemgen(colitems, reporter, keyword, self.reporterror)
try:
- dispatch_loop(nodes, itemgenerator, checkfun)
+ all_tests = dispatch_loop(nodes, itemgenerator, checkfun)
+ if all_tests:
+ todo = {}
+ for key, value in all_tests.items():
+ if key not in done_dict:
+ todo[key] = True
+ rg = randomgen(todo, done_dict)
+ dispatch_loop(nodes, rg, lambda:False, max_tasks_per_node=1)
finally:
teardown_hosts(reporter, [node.channel for node in nodes], nodes,
exitfirst=self.config.option.exitfirst)
Modified: py/dist/py/test/rsession/testing/test_master.py
==============================================================================
--- py/dist/py/test/rsession/testing/test_master.py (original)
+++ py/dist/py/test/rsession/testing/test_master.py Mon Jan 8 10:09:11 2007
@@ -9,7 +9,7 @@
if sys.platform == 'win32':
py.test.skip("rsession is unsupported on Windows.")
-from py.__.test.rsession.master import dispatch_loop, setup_slave, MasterNode
+from py.__.test.rsession.master import dispatch_loop, setup_slave, MasterNode, randomgen
from py.__.test.rsession.outcome import ReprOutcome, Outcome
from py.__.test.rsession.testing.test_slave import funcpass_spec, funcfail_spec
from py.__.test.rsession import report
@@ -118,3 +118,16 @@
[funcpass_item] * 5 + [funcfail_item] * 5)
shouldstop = lambda : False
dispatch_loop(master_nodes, itemgenerator, shouldstop)
+
+def test_randomgen():
+ d = {}
+ gen = randomgen({1:True, 2:True, 3:True}, d)
+ for i in range(100):
+ assert gen.next() in [1,2,3]
+ d[3] = True
+ for i in range(100):
+ assert gen.next() in [1,2]
+ d[2] = True
+ d[1] = True
+ py.test.raises(StopIteration, "gen.next()")
+
Modified: py/dist/py/test/rsession/testing/test_rsession.py
==============================================================================
--- py/dist/py/test/rsession/testing/test_rsession.py (original)
+++ py/dist/py/test/rsession/testing/test_rsession.py Mon Jan 8 10:09:11 2007
@@ -109,7 +109,8 @@
## res = channel.receive()
## assert res == "ok"
- def test_example_distribution_minus_x(self):
+ def test_example_distribution_minus_x(self):
+ #py.test.skip("Works, but does not test what it should")
# XXX find a better way for the below
tmpdir = py.path.local(py.__file__).dirpath().dirpath()
tmpdir.ensure("sub", "conftest.py").write(py.code.Source("""
@@ -131,7 +132,11 @@
config, args = py.test.Config.parse(args)
rsession = RSession(config)
allevents = []
- rsession.main(args, reporter=allevents.append)
+ def check():
+ return [x for x in allevents if isinstance(x, report.ReceivedItemOutcome) and
+ not x.outcome.passed]
+
+ rsession.main(args, reporter=allevents.append, override_checkfun=check)
testevents = [x for x in allevents
if isinstance(x, report.ReceivedItemOutcome)]
assert len(testevents) == 2
Modified: py/dist/py/test/rsession/web.py
==============================================================================
--- py/dist/py/test/rsession/web.py (original)
+++ py/dist/py/test/rsession/web.py Mon Jan 8 10:09:11 2007
@@ -24,11 +24,6 @@
FUNCTION_LIST = ["main", "show_skip", "show_traceback", "show_info", "hide_info",
"show_host", "hide_host"]
-def escape(s):
- return s
- #return s.replace("&", "&").replace("<", "<").replace(">", ">"). \
- # replace("'", "\\'").replace(" ", " ").replace("\n", "
")
-
try:
try:
if not session_options.import_pypy:
@@ -160,12 +155,12 @@
def show_skip(self, item_name="aa"):
return {'item_name': item_name,
- 'reason': escape(self.skip_reasons[item_name])}
+ 'reason': self.skip_reasons[item_name]}
show_skip = described(retval={"aa": "aa"})(show_skip)
def show_fail(self, item_name="aa"):
return {'item_name':item_name,
- 'traceback':escape(str(self.fail_reasons[item_name])),
+ 'traceback':str(self.fail_reasons[item_name]),
'stdout':self.stdout[item_name],
'stderr':self.stderr[item_name]}
show_fail = described(retval={"aa": "aa"})(show_fail)
@@ -260,7 +255,7 @@
args['reason'] = str(event.excinfo.value)
else:
args = {}
- args['event'] = escape(str(event))
+ args['event'] = str(event)
args['type'] = event.__class__.__name__
return args
@@ -287,6 +282,7 @@
self.pending_events.put(event)
def report_ItemStart(self, event):
+ #if isinstance(event.item, py.test.collect.Module):
self.pending_events.put(event)
def report_unknown(self, event):
@@ -391,7 +387,6 @@
javascript_source = rpython2javascript(webjs,
FUNCTION_LIST, use_pdb=False)
- # XXX: This did not work for some reason, no idea why
open(str(js_name), "w").write(javascript_source)
self.serve_data("text/javascript", javascript_source)
else:
From fijal at codespeak.net Mon Jan 8 10:12:09 2007
From: fijal at codespeak.net (fijal at codespeak.net)
Date: Mon, 8 Jan 2007 10:12:09 +0100 (CET)
Subject: [py-svn] r36222 - py/dist/py/documentation
Message-ID: <20070108091209.6058310071@code0.codespeak.net>
Author: fijal
Date: Mon Jan 8 10:12:08 2007
New Revision: 36222
Modified:
py/dist/py/documentation/test.txt
Log:
Updated to more current state.
Modified: py/dist/py/documentation/test.txt
==============================================================================
--- py/dist/py/documentation/test.txt (original)
+++ py/dist/py/documentation/test.txt Mon Jan 8 10:12:08 2007
@@ -720,10 +720,7 @@
Differences from local tests
----------------------------
-* The only working command line options are ``--session=R``, ``-x`` and ``-k``.
* Test order is *not* guaranteed.
-* ``-x`` is currently not working in the web reporter.
-* Hanging nodes or tests are not detected.
* ``conftest.py`` cannot reference files outside of the copied packages.
Configuration
From fijal at codespeak.net Mon Jan 8 10:44:22 2007
From: fijal at codespeak.net (fijal at codespeak.net)
Date: Mon, 8 Jan 2007 10:44:22 +0100 (CET)
Subject: [py-svn] r36224 - in py/dist/py/test/rsession: . webdata
Message-ID: <20070108094422.9A98D10075@code0.codespeak.net>
Author: fijal
Date: Mon Jan 8 10:44:17 2007
New Revision: 36224
Modified:
py/dist/py/test/rsession/webdata/source.js
py/dist/py/test/rsession/webjs.py
Log:
Hopefully resolve the mozilla issue with displaying tests.
Modified: py/dist/py/test/rsession/webdata/source.js
==============================================================================
Binary files. No diff available.
Modified: py/dist/py/test/rsession/webjs.py
==============================================================================
--- py/dist/py/test/rsession/webjs.py (original)
+++ py/dist/py/test/rsession/webjs.py Mon Jan 8 10:44:17 2007
@@ -228,14 +228,16 @@
def show_host(host_name="aa"):
elem = dom.document.getElementById("jobs")
- while len(elem.childNodes):
+ if elem.childNodes:
elem.removeChild(elem.childNodes[0])
+ tbody = create_elem("tbody")
for item in glob.host_pending[host_name]:
tr = create_elem("tr")
td = create_elem("td")
td.appendChild(create_text_elem(item))
tr.appendChild(td)
- elem.appendChild(tr)
+ tbody.appendChild(tr)
+ elem.appendChild(tbody)
elem.style.visibility = "visible"
glob.host = host_name
dom.setTimeout(reshow_host, 100)
From fijal at codespeak.net Mon Jan 8 10:44:34 2007
From: fijal at codespeak.net (fijal at codespeak.net)
Date: Mon, 8 Jan 2007 10:44:34 +0100 (CET)
Subject: [py-svn] r36225 - py/dist/py/test/rsession/webdata
Message-ID: <20070108094434.D89FA1007A@code0.codespeak.net>
Author: fijal
Date: Mon Jan 8 10:44:32 2007
New Revision: 36225
Modified:
py/dist/py/test/rsession/webdata/index.html
Log:
Forgotten to check that one in.
Modified: py/dist/py/test/rsession/webdata/index.html
==============================================================================
--- py/dist/py/test/rsession/webdata/index.html (original)
+++ py/dist/py/test/rsession/webdata/index.html Mon Jan 8 10:44:32 2007
@@ -81,9 +81,7 @@