diff --git a/py/test/rsession/executor.py b/py/test/rsession/executor.py index 0e1e9dff6..aa13c8633 100644 --- a/py/test/rsession/executor.py +++ b/py/test/rsession/executor.py @@ -5,7 +5,7 @@ import py, os from py.__.test.rsession.outcome import Outcome, ReprOutcome from py.__.test.rsession.box import Box -from py.__.test.rsession import report +from py.__.test.rsession import repevent from py.__.test.outcome import Skipped, Failed class RunExecutor(object): @@ -41,7 +41,7 @@ class RunExecutor(object): outcome = Outcome(excinfo=excinfo, setupfailure=False) if self.usepdb: if self.reporter is not None: - self.reporter(report.ImmediateFailure(self.item, + self.reporter(repevent.ImmediateFailure(self.item, ReprOutcome(outcome.make_repr (self.config.option.tbstyle)))) import pdb diff --git a/py/test/rsession/hostmanage.py b/py/test/rsession/hostmanage.py index 4ca5513bb..13c629f26 100644 --- a/py/test/rsession/hostmanage.py +++ b/py/test/rsession/hostmanage.py @@ -5,7 +5,7 @@ import thread, threading from py.__.test.rsession.master import MasterNode from py.__.test.rsession.slave import setup_slave -from py.__.test.rsession import report +from py.__.test.rsession import repevent class HostInfo(object): """ Class trying to store all necessary attributes @@ -117,9 +117,9 @@ class HostManager(object): for root in roots: destrelpath = root.relto(self.config.topdir) for host in self.sshhosts: - reporter(report.HostRSyncing(host)) + reporter(repevent.HostRSyncing(host)) def donecallback(): - reporter(report.HostReady(host)) + reporter(repevent.HostReady(host)) rsync.add_target_host(host, destrelpath, finishedcallback=donecallback) rsync.send(root) @@ -158,7 +158,7 @@ class HostManager(object): def teardown_gateways(self, reporter, channels): for channel in channels: try: - report.wrapcall(reporter, channel.waitclose) + repevent.wrapcall(reporter, channel.waitclose) except KeyboardInterrupt, SystemExit: raise except: diff --git a/py/test/rsession/local.py b/py/test/rsession/local.py index fa76a7fce..81a952fc2 100644 --- a/py/test/rsession/local.py +++ b/py/test/rsession/local.py @@ -5,7 +5,7 @@ import py from py.__.test.rsession.executor import BoxExecutor, RunExecutor,\ ApigenExecutor -from py.__.test.rsession import report +from py.__.test.rsession import repevent from py.__.test.rsession.outcome import ReprOutcome # XXX copied from session.py @@ -68,6 +68,6 @@ def local_loop(session, reporter, itemgenerator, shouldstop, config, runner=None if shouldstop(): return outcome = runner(item, session, reporter) - reporter(report.ReceivedItemOutcome(None, item, outcome)) + reporter(repevent.ReceivedItemOutcome(None, item, outcome)) except StopIteration: break diff --git a/py/test/rsession/master.py b/py/test/rsession/master.py index 1dbb8439a..9f05d6214 100644 --- a/py/test/rsession/master.py +++ b/py/test/rsession/master.py @@ -3,7 +3,7 @@ Node code for Master. """ import py from py.__.test.rsession.outcome import ReprOutcome -from py.__.test.rsession import report +from py.__.test.rsession import repevent class MasterNode(object): def __init__(self, channel, reporter): @@ -19,7 +19,7 @@ class MasterNode(object): def receive_result(self, outcomestring, item): repr_outcome = ReprOutcome(outcomestring) # send finish report - self.reporter(report.ReceivedItemOutcome( + self.reporter(repevent.ReceivedItemOutcome( self.channel, item, repr_outcome)) def send(self, item): @@ -30,7 +30,7 @@ class MasterNode(object): #itemspec = item.listnames()[1:] self.channel.send(item._get_collector_trail()) # send start report - self.reporter(report.SendItem(self.channel, item)) + self.reporter(repevent.SendItem(self.channel, item)) def itemgen(colitems, reporter, keyword, reporterror): def rep(x): diff --git a/py/test/rsession/report.py b/py/test/rsession/repevent.py similarity index 100% rename from py/test/rsession/report.py rename to py/test/rsession/repevent.py diff --git a/py/test/rsession/reporter.py b/py/test/rsession/reporter.py index e9c44717d..e4652c327 100644 --- a/py/test/rsession/reporter.py +++ b/py/test/rsession/reporter.py @@ -8,7 +8,7 @@ import py from py.__.test.terminal.out import getout -from py.__.test.rsession import report +from py.__.test.rsession import repevent from py.__.test.rsession import outcome from py.__.misc.terminal_helper import ansi_print, get_terminal_width from py.__.test.representation import Presenter @@ -108,7 +108,7 @@ class AbstractReporter(object): if self.failed_tests_outcome: self.out.sep("=", " FAILURES ") for event in self.failed_tests_outcome: - if isinstance(event, report.ReceivedItemOutcome): + if isinstance(event, repevent.ReceivedItemOutcome): host = self.gethost(event) self.out.sep('_', "%s on %s" % (" ".join(event.item.listnames()), host)) @@ -152,11 +152,11 @@ class AbstractReporter(object): texts = {} for event in self.skipped_tests_outcome: colitem = event.item - if isinstance(event, report.ReceivedItemOutcome): + if isinstance(event, repevent.ReceivedItemOutcome): outcome = event.outcome text = outcome.skipped itemname = self.get_item_name(event, colitem) - elif isinstance(event, report.SkippedTryiter): + elif isinstance(event, repevent.SkippedTryiter): text = str(event.excinfo.value) itemname = "/".join(colitem.listnames()) if text not in texts: diff --git a/py/test/rsession/rest.py b/py/test/rsession/rest.py index ddcacdcf7..b621b619a 100644 --- a/py/test/rsession/rest.py +++ b/py/test/rsession/rest.py @@ -6,7 +6,7 @@ import py import sys from StringIO import StringIO from py.__.test.rsession.reporter import AbstractReporter -from py.__.test.rsession import report +from py.__.test.rsession import repevent from py.__.rest.rst import * class RestReporter(AbstractReporter): @@ -122,11 +122,11 @@ class RestReporter(AbstractReporter): texts = {} for event in self.skipped_tests_outcome: colitem = event.item - if isinstance(event, report.ReceivedItemOutcome): + if isinstance(event, repevent.ReceivedItemOutcome): outcome = event.outcome text = outcome.skipped itemname = self.get_item_name(event, colitem) - elif isinstance(event, report.SkippedTryiter): + elif isinstance(event, repevent.SkippedTryiter): text = str(event.excinfo.value) itemname = "/".join(colitem.listnames()) if text not in texts: @@ -153,7 +153,7 @@ class RestReporter(AbstractReporter): for i, event in enumerate(self.failed_tests_outcome): if i > 0: self.add_rest(Transition()) - if isinstance(event, report.ReceivedItemOutcome): + if isinstance(event, repevent.ReceivedItemOutcome): host = self.get_host(event) itempath = self.get_path_from_item(event.item) root = self.get_rootpath(event.item) diff --git a/py/test/rsession/rsession.py b/py/test/rsession/rsession.py index e5601bf1a..a4564bf9f 100644 --- a/py/test/rsession/rsession.py +++ b/py/test/rsession/rsession.py @@ -8,7 +8,7 @@ import sys import re import time -from py.__.test.rsession import report +from py.__.test.rsession import repevent from py.__.test.rsession.master import MasterNode, dispatch_loop, itemgen from py.__.test.rsession.hostmanage import HostInfo, HostManager from py.__.test.rsession.local import local_loop, plain_runner, apigen_runner,\ @@ -70,11 +70,11 @@ class AbstractSession(Session): def reporterror(reporter, data): excinfo, item = data if excinfo is None: - reporter(report.ItemStart(item)) + reporter(repevent.ItemStart(item)) elif excinfo.type is Skipped: - reporter(report.SkippedTryiter(excinfo, item)) + reporter(repevent.SkippedTryiter(excinfo, item)) else: - reporter(report.FailedTryiter(excinfo, item)) + reporter(repevent.FailedTryiter(excinfo, item)) reporterror = staticmethod(reporterror) def kill_server(self, startserverflag): @@ -90,7 +90,7 @@ class AbstractSession(Session): """ self.was_failure = False def new_reporter(event): - if isinstance(event, report.ReceivedItemOutcome) and \ + if isinstance(event, repevent.ReceivedItemOutcome) and \ not event.outcome.passed and \ not event.outcome.skipped: self.was_failure = True @@ -130,12 +130,12 @@ class RSession(AbstractSession): sshhosts, RemoteReporter) reporter, checkfun = self.wrap_reporter(reporter) - reporter(report.TestStarted(sshhosts)) + reporter(repevent.TestStarted(sshhosts)) hostmanager = HostManager(sshhosts, self.config) try: nodes = hostmanager.init_hosts(reporter) - reporter(report.RsyncFinished()) + reporter(repevent.RsyncFinished()) try: self.dispatch_tests(nodes, reporter, checkfun) except (KeyboardInterrupt, SystemExit): @@ -149,16 +149,16 @@ class RSession(AbstractSession): channels = [node.channel for node in nodes] hostmanager.teardown_hosts(reporter, channels, nodes, exitfirst=self.config.option.exitfirst) - reporter(report.Nodes(nodes)) - retval = reporter(report.TestFinished()) + reporter(repevent.Nodes(nodes)) + retval = reporter(repevent.TestFinished()) self.kill_server(startserverflag) return retval except (KeyboardInterrupt, SystemExit): - reporter(report.InterruptedExecution()) + reporter(repevent.InterruptedExecution()) self.kill_server(startserverflag) raise except: - reporter(report.CrashedExecution()) + reporter(repevent.CrashedExecution()) self.kill_server(startserverflag) raise @@ -189,9 +189,9 @@ class LSession(AbstractSession): sshhosts, LocalReporter, args[0]) reporter, checkfun = self.wrap_reporter(reporter) - reporter(report.TestStarted(sshhosts)) + reporter(repevent.TestStarted(sshhosts)) colitems = self.config.getcolitems() - reporter(report.RsyncFinished()) + reporter(repevent.RsyncFinished()) if runner is None: runner = self.init_runner() @@ -201,7 +201,7 @@ class LSession(AbstractSession): itemgenerator = itemgen(colitems, reporter, keyword, self.reporterror) local_loop(self, reporter, itemgenerator, checkfun, self.config, runner=runner) - retval = reporter(report.TestFinished()) + retval = reporter(repevent.TestFinished()) self.kill_server(startserverflag) if not self.config.option.nomagic: diff --git a/py/test/rsession/testing/test_lsession.py b/py/test/rsession/testing/test_lsession.py index 74cabda8c..b730fb969 100644 --- a/py/test/rsession/testing/test_lsession.py +++ b/py/test/rsession/testing/test_lsession.py @@ -4,7 +4,7 @@ import py from py.__.test.rsession.rsession import LSession -from py.__.test.rsession import report +from py.__.test.rsession import repevent from py.__.test.rsession.local import box_runner, plain_runner, apigen_runner def setup_module(mod): @@ -37,7 +37,7 @@ class TestLSession(object): allevents = [] lsession.main(reporter=allevents.append, runner=runner) testevents = [x for x in allevents - if isinstance(x, report.ReceivedItemOutcome)] + if isinstance(x, repevent.ReceivedItemOutcome)] assert len(testevents) passevents = [i for i in testevents if i.outcome.passed] failevents = [i for i in testevents if i.outcome.excinfo] @@ -97,7 +97,7 @@ class TestLSession(object): else: py.test.fail("Didn't raise system exit") failure_events = [event for event in allevents if isinstance(event, - report.ImmediateFailure)] + repevent.ImmediateFailure)] assert len(failure_events) == 1 assert len(l) == 1 finally: @@ -127,7 +127,7 @@ class TestLSession(object): lsession.main(reporter=allevents.append, runner=box_runner) testevents = [x for x in allevents - if isinstance(x, report.ReceivedItemOutcome)] + if isinstance(x, repevent.ReceivedItemOutcome)] assert len(testevents) passevents = [i for i in testevents if i.outcome.passed] failevents = [i for i in testevents if i.outcome.excinfo] @@ -156,7 +156,7 @@ class TestLSession(object): lsession.main(reporter=allevents.append, runner=box_runner) testevents = [x for x in allevents - if isinstance(x, report.ReceivedItemOutcome)] + if isinstance(x, repevent.ReceivedItemOutcome)] assert len(testevents) passevents = [i for i in testevents if i.outcome.passed] failevents = [i for i in testevents if i.outcome.excinfo] @@ -190,7 +190,7 @@ class TestLSession(object): assert len(allruns) == 4 testevents = [x for x in allevents - if isinstance(x, report.ReceivedItemOutcome)] + if isinstance(x, repevent.ReceivedItemOutcome)] assert len(testevents) == 4 lst = ['test_one', 'test_one_one', 'test_other', 'test_two'] for num, i in enumerate(testevents): @@ -214,13 +214,13 @@ class TestLSession(object): allevents = [] lsession.main(reporter=allevents.append, runner=box_runner) testevents = [x for x in allevents - if isinstance(x, report.ReceivedItemOutcome)] + if isinstance(x, repevent.ReceivedItemOutcome)] assert len(testevents) == 0 failedtryiter = [x for x in allevents - if isinstance(x, report.FailedTryiter)] + if isinstance(x, repevent.FailedTryiter)] assert len(failedtryiter) == 1 skippedtryiter = [x for x in allevents - if isinstance(x, report.SkippedTryiter)] + if isinstance(x, repevent.SkippedTryiter)] assert len(skippedtryiter) == 1 @@ -240,7 +240,7 @@ class TestLSession(object): allevents = [] lsession.main(reporter=allevents.append, runner=box_runner) testevents = [x for x in allevents - if isinstance(x, report.ReceivedItemOutcome)] + if isinstance(x, repevent.ReceivedItemOutcome)] failevents = [i for i in testevents if i.outcome.excinfo] assert len(failevents) == 1 assert len(testevents) == 1 @@ -261,7 +261,7 @@ class TestLSession(object): allevents = [] lsession.main(reporter=allevents.append, runner=plain_runner) testevents = [x for x in allevents - if isinstance(x, report.ReceivedItemOutcome)] + if isinstance(x, repevent.ReceivedItemOutcome)] assert len(testevents) == 1 assert testevents[0].outcome.passed assert testevents[0].outcome.stderr == "" diff --git a/py/test/rsession/testing/test_master.py b/py/test/rsession/testing/test_master.py index ef2fb7c9d..698e86c39 100644 --- a/py/test/rsession/testing/test_master.py +++ b/py/test/rsession/testing/test_master.py @@ -12,7 +12,7 @@ if sys.platform == 'win32': from py.__.test.rsession.master import dispatch_loop, MasterNode from py.__.test.rsession.slave import setup_slave from py.__.test.rsession.outcome import ReprOutcome, Outcome -from py.__.test.rsession import report +from py.__.test.rsession import repevent from py.__.test.rsession.hostmanage import HostInfo def setup_module(mod): @@ -58,7 +58,7 @@ def test_masternode(): ch.callback(Outcome(excinfo=excinfo).make_repr()) assert len(reportlist) == 4 received = [i for i in reportlist - if isinstance(i, report.ReceivedItemOutcome)] + if isinstance(i, repevent.ReceivedItemOutcome)] assert received[0].outcome.passed assert not received[1].outcome.passed @@ -134,7 +134,7 @@ class TestSlave: def test_slave_running(self): py.test.skip("XXX test broken, needs refactoring") def simple_report(event): - if not isinstance(event, report.ReceivedItemOutcome): + if not isinstance(event, repevent.ReceivedItemOutcome): return item = event.item if item.code.name == 'funcpass': @@ -162,7 +162,7 @@ class TestSlave: def test_slave_running_interrupted(): py.test.skip("XXX test broken, needs refactoring") #def simple_report(event): - # if not isinstance(event, report.ReceivedItemOutcome): + # if not isinstance(event, repevent.ReceivedItemOutcome): # return # item = event.item # if item.code.name == 'funcpass': diff --git a/py/test/rsession/testing/test_report.py b/py/test/rsession/testing/test_report.py index ce1f9ca4b..3c56420c7 100644 --- a/py/test/rsession/testing/test_report.py +++ b/py/test/rsession/testing/test_report.py @@ -1,17 +1,17 @@ """ test reporting functionality. """ import py -from py.__.test.rsession import report +from py.__.test.rsession import repevent def test_wrapcall_ok(): l = [] def ok(x): return x+1 - i = report.wrapcall(l.append, ok, 1) + i = repevent.wrapcall(l.append, ok, 1) assert i == 2 assert len(l) == 2 - assert isinstance(l[0], report.CallStart) - assert isinstance(l[1], report.CallFinish) + assert isinstance(l[0], repevent.CallStart) + assert isinstance(l[1], repevent.CallFinish) assert repr(l[0]) assert repr(l[1]) @@ -19,18 +19,18 @@ def test_wrapcall_exception(): l = [] def fail(x): raise ValueError - py.test.raises(ValueError, "report.wrapcall(l.append, fail, 1)") + py.test.raises(ValueError, "repevent.wrapcall(l.append, fail, 1)") assert len(l) == 2 - assert isinstance(l[0], report.CallStart) - assert isinstance(l[1], report.CallException) + assert isinstance(l[0], repevent.CallStart) + assert isinstance(l[1], repevent.CallException) def test_reporter_methods_sanity(): """ Checks if all the methods of reporter are sane """ from py.__.test.rsession.rsession import RemoteReporter - from py.__.test.rsession import report + from py.__.test.rsession import repevent for method in dir(RemoteReporter): if method.startswith("report_") and method != "report_unknown": - assert method[len('report_'):] in report.__dict__ + assert method[len('report_'):] in repevent.__dict__ diff --git a/py/test/rsession/testing/test_reporter.py b/py/test/rsession/testing/test_reporter.py index ca6fac911..1dae5edb2 100644 --- a/py/test/rsession/testing/test_reporter.py +++ b/py/test/rsession/testing/test_reporter.py @@ -21,7 +21,7 @@ import py, os #py.test.skip("in progress") from py.__.test.rsession.rsession import LocalReporter, AbstractSession,\ RemoteReporter -from py.__.test.rsession import report +from py.__.test.rsession import repevent from py.__.test.rsession.outcome import ReprOutcome, Outcome from py.__.test.rsession.testing.test_slave import funcpass_spec, mod_spec from py.__.test.rsession.hostmanage import HostInfo @@ -72,7 +72,7 @@ class AbstractTestReporter(object): r = self.reporter(config, hosts) ch = DummyChannel(hosts[0]) for outcome in outcomes: - r.report(report.ReceivedItemOutcome(ch, item, outcome)) + r.report(repevent.ReceivedItemOutcome(ch, item, outcome)) cap = py.io.StdCaptureFD() boxfun(config, item, outcomes) @@ -92,10 +92,10 @@ class AbstractTestReporter(object): hosts = [HostInfo('localhost')] r = self.reporter(config, hosts) #r.pkgdir = pkdgir - r.report(report.ItemStart(item)) + r.report(repevent.ItemStart(item)) ch = DummyChannel(hosts[0]) for outcome in outcomes: - r.report(report.ReceivedItemOutcome(ch, funcitem, outcome)) + r.report(repevent.ReceivedItemOutcome(ch, funcitem, outcome)) cap = py.io.StdCaptureFD() boxfun(self.pkgdir, config, moditem, funcitem, outcomes) @@ -142,10 +142,10 @@ class AbstractTestReporter(object): rootcol = py.test.collect.Directory(tmpdir) host = HostInfo('localhost') r = self.reporter(config, [host]) - r.report(report.TestStarted([host])) - r.report(report.RsyncFinished()) + r.report(repevent.TestStarted([host])) + r.report(repevent.RsyncFinished()) list(rootcol._tryiter(reporterror=lambda x : AbstractSession.reporterror(r.report, x))) - r.report(report.TestFinished()) + r.report(repevent.TestFinished()) cap = py.io.StdCaptureFD() boxfun() @@ -160,10 +160,10 @@ class AbstractTestReporter(object): config = py.test.config._reparse([str(tmpdir)]) hosts = [HostInfo(i) for i in ["host1", "host2", "host3"]] r = self.reporter(config, hosts) - r.report(report.TestStarted(hosts)) - r.report(report.HostReady(hosts[0])) - r.report(report.HostReady(hosts[1])) - r.report(report.HostReady(hosts[2])) + r.report(repevent.TestStarted(hosts)) + r.report(repevent.HostReady(hosts[0])) + r.report(repevent.HostReady(hosts[1])) + r.report(repevent.HostReady(hosts[2])) out, err = cap.reset() assert not err expected1 = "Test started, hosts: host1, host2, host3" diff --git a/py/test/rsession/testing/test_rest.py b/py/test/rsession/testing/test_rest.py index d666aec1b..bf055ec1c 100644 --- a/py/test/rsession/testing/test_rest.py +++ b/py/test/rsession/testing/test_rest.py @@ -5,7 +5,7 @@ import py from py.__.test.rsession.testing.test_reporter import AbstractTestReporter,\ DummyChannel -from py.__.test.rsession import report +from py.__.test.rsession import repevent from py.__.test.rsession.rest import RestReporter, NoLinkWriter from py.__.rest.rst import * from py.__.test.rsession.hostmanage import HostInfo @@ -41,7 +41,7 @@ class TestRestUnits(object): self.config.option.verbose = False def test_report_SendItem(self): - event = report.SendItem(item='foo/bar.py', channel=ch) + event = repevent.SendItem(item='foo/bar.py', channel=ch) reporter.report(event) assert stdout.getvalue() == '' stdout.seek(0) @@ -52,18 +52,18 @@ class TestRestUnits(object): 'localhost\n\n') def test_report_HostRSyncing(self): - event = report.HostRSyncing(HostInfo('localhost:/foo/bar')) + event = repevent.HostRSyncing(HostInfo('localhost:/foo/bar')) reporter.report(event) assert stdout.getvalue() == ('::\n\n localhost: RSYNC ==> ' '/foo/bar\n\n') def test_report_HostReady(self): - event = report.HostReady(HostInfo('localhost')) + event = repevent.HostReady(HostInfo('localhost')) reporter.report(event) assert stdout.getvalue() == '::\n\n localhost: READY\n\n' def test_report_TestStarted(self): - event = report.TestStarted(hosts=[HostInfo('localhost'), + event = repevent.TestStarted(hosts=[HostInfo('localhost'), HostInfo('foo.com')]) reporter.report(event) assert stdout.getvalue() == """\ @@ -84,7 +84,7 @@ Running tests on hosts\: localhost, foo.com return ['package', 'foo', 'bar.py'] parent = Container(parent=None, fspath=py.path.local('.')) - event = report.ItemStart(item=FakeModule(parent)) + event = repevent.ItemStart(item=FakeModule(parent)) reporter.report(event) assert stdout.getvalue() == """\ Testing module foo/bar.py (2 items) @@ -106,7 +106,7 @@ Testing module foo/bar.py (2 items) def test_ReceivedItemOutcome_PASSED(self): outcome = Outcome() item = Container(listnames=lambda: ['', 'foo.py', 'bar', '()', 'baz']) - event = report.ReceivedItemOutcome(channel=ch, outcome=outcome, item=item) + event = repevent.ReceivedItemOutcome(channel=ch, outcome=outcome, item=item) reporter.report(event) assert stdout.getvalue() == ('* localhost\\: **PASSED** ' 'foo.py/bar()/baz\n\n') @@ -114,7 +114,7 @@ Testing module foo/bar.py (2 items) def test_ReceivedItemOutcome_SKIPPED(self): outcome = Outcome(skipped="reason") item = Container(listnames=lambda: ['', 'foo.py', 'bar', '()', 'baz']) - event = report.ReceivedItemOutcome(channel=ch, outcome=outcome, item=item) + event = repevent.ReceivedItemOutcome(channel=ch, outcome=outcome, item=item) reporter.report(event) assert stdout.getvalue() == ('* localhost\\: **SKIPPED** ' 'foo.py/bar()/baz\n\n') @@ -122,7 +122,7 @@ Testing module foo/bar.py (2 items) def test_ReceivedItemOutcome_FAILED(self): outcome = Outcome(excinfo="xxx") item = Container(listnames=lambda: ['', 'foo.py', 'bar', '()', 'baz']) - event = report.ReceivedItemOutcome(channel=ch, outcome=outcome, item=item) + event = repevent.ReceivedItemOutcome(channel=ch, outcome=outcome, item=item) reporter.report(event) assert stdout.getvalue() == """\ * localhost\: **FAILED** `traceback0`_ foo.py/bar()/baz @@ -154,7 +154,7 @@ Testing module foo/bar.py (2 items) parent = Container(parent=None, fspath=py.path.local('.')) item = Container(listnames=lambda: ['', 'foo.py', 'bar', '()', 'baz'], parent=parent, fspath=py.path.local('foo')) - event = report.ReceivedItemOutcome(channel=ch, outcome=outcome, + event = repevent.ReceivedItemOutcome(channel=ch, outcome=outcome, item=item) reporter.report(event) reporter.timestart = 10 @@ -167,10 +167,10 @@ Testing module foo/bar.py (2 items) assert out.find('') > -1 def test_skips(self): - class FakeOutcome(Container, report.ReceivedItemOutcome): + class FakeOutcome(Container, repevent.ReceivedItemOutcome): pass - class FakeTryiter(Container, report.SkippedTryiter): + class FakeTryiter(Container, repevent.SkippedTryiter): pass reporter.skips() @@ -192,7 +192,7 @@ Reasons for skipped tests\: """ def test_failures(self): - class FakeOutcome(Container, report.ReceivedItemOutcome): + class FakeOutcome(Container, repevent.ReceivedItemOutcome): pass parent = Container(parent=None, fspath=py.path.local('.')) diff --git a/py/test/rsession/testing/test_rsession.py b/py/test/rsession/testing/test_rsession.py index 61a0856a6..25d64c4e1 100644 --- a/py/test/rsession/testing/test_rsession.py +++ b/py/test/rsession/testing/test_rsession.py @@ -3,7 +3,7 @@ """ import py -from py.__.test.rsession import report +from py.__.test.rsession import repevent from py.__.test.rsession.rsession import RSession from py.__.test.rsession.hostmanage import HostManager, HostInfo from py.__.test.rsession.testing.test_slave import funcfail_spec,\ @@ -56,7 +56,7 @@ class TestRSessionRemote(DirSetup): allevents = [] rsession.main(reporter=allevents.append) testevents = [x for x in allevents - if isinstance(x, report.ReceivedItemOutcome)] + if isinstance(x, repevent.ReceivedItemOutcome)] assert len(testevents) == 3 assert rsession.checkfun() @@ -92,7 +92,7 @@ class TestRSessionRemote(DirSetup): allevents = [] rsession.main(reporter=allevents.append) testevents = [x for x in allevents - if isinstance(x, report.ReceivedItemOutcome)] + if isinstance(x, repevent.ReceivedItemOutcome)] assert len(testevents) print testevents passevents = [i for i in testevents if i.outcome.passed] @@ -127,17 +127,17 @@ class TestRSessionRemote(DirSetup): [node.channel for node in nodes], nodes) count_rsyn_calls = [i for i in setup_events - if isinstance(i, report.HostRSyncing)] + if isinstance(i, repevent.HostRSyncing)] assert len(count_rsyn_calls) == len([i for i in hosts]) count_ready_calls = [i for i in setup_events - if isinstance(i, report.HostReady)] + if isinstance(i, repevent.HostReady)] assert len(count_ready_calls) == len([i for i in hosts]) # same for teardown events teardown_wait_starts = [i for i in teardown_events - if isinstance(i, report.CallStart)] + if isinstance(i, repevent.CallStart)] teardown_wait_ends = [i for i in teardown_events - if isinstance(i, report.CallFinish)] + if isinstance(i, repevent.CallFinish)] assert len(teardown_wait_starts) == len(hosts) assert len(teardown_wait_ends) == len(hosts) @@ -168,7 +168,7 @@ class TestRSessionRemote(DirSetup): hm.teardown_hosts(allevents.append, [node.channel for node in nodes], nodes) events = [i for i in allevents - if isinstance(i, report.ReceivedItemOutcome)] + if isinstance(i, repevent.ReceivedItemOutcome)] passed = [i for i in events if i.outcome.passed] skipped = [i for i in events @@ -201,7 +201,7 @@ class TestRSessionRemote(DirSetup): allevents = [] rsession.main(reporter=allevents.append) testevents = [x for x in allevents - if isinstance(x, report.ReceivedItemOutcome)] + if isinstance(x, repevent.ReceivedItemOutcome)] passevents = [x for x in testevents if x.outcome.passed] assert len(passevents) == 1 diff --git a/py/test/rsession/web.py b/py/test/rsession/web.py index 0cf3ee663..ed460a00a 100644 --- a/py/test/rsession/web.py +++ b/py/test/rsession/web.py @@ -15,7 +15,7 @@ import socket import py from py.__.test.rsession.rsession import RSession -from py.__.test.rsession import report +from py.__.test.rsession import repevent from py.__.test import collect from py.__.test.rsession.webdata import json @@ -221,7 +221,7 @@ class ExportedMethods(BasicExternal): self.end_event.set() return {} # some dispatcher here - if isinstance(event, report.ReceivedItemOutcome): + if isinstance(event, repevent.ReceivedItemOutcome): args = {} outcome = event.outcome for key, val in outcome.__dict__.iteritems(): @@ -246,22 +246,22 @@ class ExportedMethods(BasicExternal): args['hostkey'] = event.channel.gateway.host.hostid else: args['hostkey'] = '' - elif isinstance(event, report.ItemStart): + elif isinstance(event, repevent.ItemStart): args = add_item(event) - elif isinstance(event, report.TestFinished): + elif isinstance(event, repevent.TestFinished): args = {} args['run'] = str(self.all) args['fails'] = str(len(self.fail_reasons)) args['skips'] = str(len(self.skip_reasons)) - elif isinstance(event, report.SendItem): + elif isinstance(event, repevent.SendItem): args = add_item(event) args['hostkey'] = event.channel.gateway.host.hostid - elif isinstance(event, report.HostReady): + elif isinstance(event, repevent.HostReady): self.ready_hosts[event.host] = True args = {'hostname' : event.host.hostname, 'hostkey' : event.host.hostid} - elif isinstance(event, report.FailedTryiter): + elif isinstance(event, repevent.FailedTryiter): args = add_item(event) - elif isinstance(event, report.SkippedTryiter): + elif isinstance(event, repevent.SkippedTryiter): args = add_item(event) args['reason'] = str(event.excinfo.value) else: