holger krekel avatar holger krekel committed c2e2cfb

fix and shorten collection reporting and fix a test wrt internal pytest api

Comments (0)

Files changed (4)

 
 setup(
     name="pytest-xdist",
-    version='1.5',
+    version='1.6',
     description='py.test xdist plugin for distributed testing and loop-on-failing modes',
     long_description=open('README.txt').read(),
     license='GPLv2 or later',

testing/test_remote.py

     config1 = testdir.parseconfig()
     config2 = remote_initconfig(config1.option.__dict__, config1.args)
     assert config2.option.__dict__ == config1.option.__dict__
-    py.test.raises(KeyError, 'config2.pluginmanager.getplugin("terminal")')
+    assert config2.pluginmanager.getplugin("terminal") == None
 
 class TestReportSerialization:
     def test_itemreport_outcomes(self, testdir):

xdist/__init__.py

 #
-__version__ = '1.5'
+__version__ = '1.6'

xdist/dsession.py

 
         if self.sched.collection_is_completed:
             if self.terminal:
+                self.trdist.ensure_show_status()
                 self.terminal.write_line("")
                 self.terminal.write_line("scheduling tests via %s" %(
                     self.sched.__class__.__name__))
     def write_line(self, msg):
         self.tr.write_line(msg)
 
+    def ensure_show_status(self):
+        if not self.tr.hasmarkup:
+            self.write_line(self.getstatus())
+
     def setstatus(self, spec, status, show=True):
         self._status[spec.id] = status
-        if show:
-            parts = ["%s %s" %(spec.id, self._status[spec.id])
-                       for spec in self._specs]
-            line = " / ".join(parts)
-            self.rewrite(line)
+        if show and self.tr.hasmarkup:
+            self.rewrite(self.getstatus())
+
+    def getstatus(self):
+        parts = ["%s %s" %(spec.id, self._status[spec.id])
+                   for spec in self._specs]
+        return " / ".join(parts)
 
     def rewrite(self, line, newline=False):
         pline = line + " " * max(self._lastlen-len(line), 0)
     def pytest_xdist_setupnodes(self, specs):
         self._specs = specs
         for spec in specs:
-            self.setstatus(spec, "initializing", show=False)
-        self.setstatus(spec, "initializing", show=True)
+            self.setstatus(spec, "I", show=False)
+        self.setstatus(spec, "I", show=True)
+        self.ensure_show_status()
 
     def pytest_xdist_newgateway(self, gateway):
         if self.config.option.verbose > 0:
             self.rewrite("[%s] %s Python %s cwd: %s" % (
                 gateway.id, rinfo.platform, version, rinfo.cwd),
                 newline=True)
-        self.setstatus(gateway.spec, "collecting")
+        self.setstatus(gateway.spec, "C")
 
     def pytest_testnodeready(self, node):
         if self.config.option.verbose > 0:
                 d['id'],
                 d['version'].replace('\n', ' -- '),)
             self.rewrite(infoline, newline=True)
-        self.setstatus(node.gateway.spec, "ready")
+        self.setstatus(node.gateway.spec, "ok")
 
     def pytest_testnodedown(self, node, error):
         if not error:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.