diff --git a/py/doc/execnet.txt b/py/doc/execnet.txt index d24582568..9d297d370 100644 --- a/py/doc/execnet.txt +++ b/py/doc/execnet.txt @@ -137,8 +137,7 @@ Instantiating a gateway from a string-specification To specify Gateways with a String:: >>> import py - >>> gwspec = py.execnet.GatewaySpec("popen") - >>> gw = gwspec.makegateway() + >>> gw = py.execnet.makegateway("popen") >>> ex = gw.remote_exec("import sys ; channel.send(sys.executable)").receive() >>> assert ex == py.std.sys.executable, (ex, py.std.sys.executable) >>> diff --git a/py/test/dsession/dsession.py b/py/test/dsession/dsession.py index 59f4a0ab2..31027592f 100644 --- a/py/test/dsession/dsession.py +++ b/py/test/dsession/dsession.py @@ -212,7 +212,7 @@ class DSession(Session): # "sending same item %r to multiple " # "not implemented" %(item,)) self.item2node[item] = node - self.bus.notify("itemstart", event.ItemStart(item, node)) + self.bus.notify("itemstart", item, node) pending.extend(sending) tosend[:] = tosend[room:] # update inplace if not tosend: diff --git a/py/test/dsession/testing/test_nodemanage.py b/py/test/dsession/testing/test_nodemanage.py index 1ce18964b..1b680627e 100644 --- a/py/test/dsession/testing/test_nodemanage.py +++ b/py/test/dsession/testing/test_nodemanage.py @@ -124,6 +124,7 @@ class TestOptionsAndConfiguration: assert len(xspecs) == 3 def test_getxspecs(self, testdir): + testdir.chdir() config = testdir.parseconfig("--tx=popen", "--tx", "ssh=xyz") xspecs = config.getxspecs() assert len(xspecs) == 2 diff --git a/py/test/dsession/txnode.py b/py/test/dsession/txnode.py index 1dd97600e..c40bc8d9e 100644 --- a/py/test/dsession/txnode.py +++ b/py/test/dsession/txnode.py @@ -43,6 +43,10 @@ class MasterNode(object): elif eventname == "slavefinished": self._down = True self.notify("testnodedown", self, None) + elif eventname == "itemtestreport": + rep = args[0] + rep.node = self + self.notify("itemtestreport", rep) else: self.notify(eventname, *args, **kwargs) except KeyboardInterrupt: diff --git a/py/test/event.py b/py/test/event.py index 9e446c3a9..c6bec83b3 100644 --- a/py/test/event.py +++ b/py/test/event.py @@ -45,12 +45,6 @@ class InternalException(BaseEvent): # Events related to collecting and executing test Items # ---------------------------------------------------------------------- -class ItemStart(BaseEvent): - def __init__(self, item, host=None): - self.item = item - self.host = host - self.time = timestamp() - class Deselected(BaseEvent): def __init__(self, items): self.items = items diff --git a/py/test/plugin/pytest_plugintester.py b/py/test/plugin/pytest_plugintester.py index 388512203..4338910ab 100644 --- a/py/test/plugin/pytest_plugintester.py +++ b/py/test/plugin/pytest_plugintester.py @@ -173,7 +173,7 @@ class PytestPluginHooks: def pyevent_internalerror(self, event): """ called for internal errors. """ - def pyevent_itemstart(self, event): + def pyevent_itemstart(self, item, node): """ test item gets collected. """ def pyevent_itemtestreport(self, event): diff --git a/py/test/plugin/pytest_terminal.py b/py/test/plugin/pytest_terminal.py index b0b5a6def..ded5a7fdf 100644 --- a/py/test/plugin/pytest_terminal.py +++ b/py/test/plugin/pytest_terminal.py @@ -133,19 +133,19 @@ class TerminalReporter: self.config.option.traceconfig and category.find("config") != -1: self.write_line("[%s] %s" %(category, msg)) - def pyevent_itemstart(self, event): - if self.config.option.verbose: - info = event.item.repr_metainfo() + def pyevent_itemstart(self, item, node=None): + if self.config.option.debug: + info = item.repr_metainfo() line = info.verboseline(basedir=self.curdir) + " " extra = "" - if event.host: - extra = "-> " + str(event.host) + if node: + extra = "-> " + str(node.gateway.id) self.write_ensure_prefix(line, extra) - else: - # ensure that the path is printed before the 1st test of - # a module starts running - fspath = event.item.fspath - self.write_fspath_result(fspath, "") + #else: + # # ensure that the path is printed before the 1st test of + # # a module starts running + # fspath = item.fspath + # self.write_fspath_result(fspath, "") def pyevent_rescheduleitems(self, event): if self.config.option.debug: @@ -167,7 +167,13 @@ class TerminalReporter: else: info = event.colitem.repr_metainfo() line = info.verboseline(basedir=self.curdir) + " " - self.write_ensure_prefix(line, word, **markup) + #self.write_ensure_prefix(line, word, **markup) + self.ensure_newline() + if hasattr(event, 'node'): + self._tw.write("%s " % event.node.gateway.id) + self._tw.write(word, **markup) + self._tw.write(" " + line) + self.currentfspath = -2 def pyevent_collectionreport(self, event): if not event.passed: @@ -294,8 +300,8 @@ class CollectonlyReporter: self.outindent(event.collector) self.indent += self.INDENT - def pyevent_itemstart(self, event): - self.outindent(event.item) + def pyevent_itemstart(self, item, node=None): + self.outindent(item) def pyevent_collectionreport(self, event): if not event.passed: @@ -389,16 +395,17 @@ class TestTerminal: rep.config.bus.register(rep) rep.config.bus.notify("testrunstart", event.TestrunStart()) items = modcol.collect() + rep.config.option.debug = True # for item in items: - rep.config.bus.notify("itemstart", event.ItemStart(item)) + rep.config.bus.notify("itemstart", item, None) s = linecomp.stringio.getvalue().strip() assert s.endswith(item.name) rep.config.bus.notify("itemtestreport", basic_run_report(item)) linecomp.assert_contains_lines([ - "*test_pass_skip_fail_verbose.py:2: *test_ok*PASS", - "*test_pass_skip_fail_verbose.py:4: *test_skip*SKIP", - "*test_pass_skip_fail_verbose.py:6: *test_func*FAIL", + "*PASS*test_pass_skip_fail_verbose.py:2: *test_ok*", + "*SKIP*test_pass_skip_fail_verbose.py:4: *test_skip*", + "*FAIL*test_pass_skip_fail_verbose.py:6: *test_func*", ]) rep.config.bus.notify("testrunfinish", event.TestrunFinish()) linecomp.assert_contains_lines([ @@ -536,7 +543,8 @@ class TestTerminal: modcol.config.bus.register(rep) l = list(testdir.genitems([modcol])) assert len(l) == 1 - rep.config.bus.notify("itemstart", event.ItemStart(l[0])) + modcol.config.option.debug = True + rep.config.bus.notify("itemstart", l[0]) linecomp.assert_contains_lines([ "*test_show_path_before_running_test.py*" ]) @@ -619,7 +627,7 @@ class TestCollectonly: "" ]) item = modcol.join("test_func") - rep.config.bus.notify("itemstart", event.ItemStart(item)) + rep.config.bus.notify("itemstart", item) linecomp.assert_contains_lines([ " ", ]) diff --git a/py/test/session.py b/py/test/session.py index d5833fcd7..a3dd379e1 100644 --- a/py/test/session.py +++ b/py/test/session.py @@ -50,7 +50,7 @@ class Session(object): if isinstance(next, Item): remaining = self.filteritems([next]) if remaining: - notify("itemstart", event.ItemStart(next)) + notify("itemstart", next) yield next else: assert isinstance(next, Collector) diff --git a/py/test/testing/acceptance_test.py b/py/test/testing/acceptance_test.py index 3c326c0b5..202f69ed0 100644 --- a/py/test/testing/acceptance_test.py +++ b/py/test/testing/acceptance_test.py @@ -361,10 +361,10 @@ class TestPyTest: """) result = testdir.runpytest(p1, '-v') result.stdout.fnmatch_lines([ - "*test_verbose_reporting.py:2: test_fail*FAIL", - "*test_verbose_reporting.py:4: test_pass*PASS", - "*test_verbose_reporting.py:7: TestClass.test_skip*SKIP", - "*test_verbose_reporting.py:10: test_gen*FAIL", + "*FAIL*test_verbose_reporting.py:2: test_fail*", + "*PASS*test_verbose_reporting.py:4: test_pass*", + "*SKIP*test_verbose_reporting.py:7: TestClass.test_skip*", + "*FAIL*test_verbose_reporting.py:10: test_gen*", ]) assert result.ret == 1