Ronny Pfannschmidt avatar Ronny Pfannschmidt committed b2bd044

initial

Comments (0)

Files changed (2)

report-activity-group

+# HG changeset patch
+# Parent f9f8c0107cc160444cc32e303bff3939941d2837
+have reporting lines group envs by activity
+
+diff --git a/detox/proc.py b/detox/proc.py
+--- a/detox/proc.py
++++ b/detox/proc.py
+@@ -9,49 +9,34 @@ import eventlet
+ import tox._config
+ import tox._cmdline
+ 
++from itertools import cycle
++spin_chars = cycle("-\|/-\|/")
++
++
+ def timelimited(secs, func):
+     if secs is not None:
+         with Timeout(secs):
+             return func()
+     return func()
+ 
+-class FileSpinner:
+-    chars = "- \ | / - \ | /".split()
+-    def __init__(self):
+-        self.path2last = {}
+-
+-    def getchar(self, path):
+-        try:
+-            lastsize, charindex = self.path2last[path]
+-        except KeyError:
+-            lastsize, charindex = 0, 0
+-        newsize = path.size()
+-        if newsize != lastsize:
+-            charindex += 1
+-        self.path2last[path] = (lastsize, charindex)
+-        return self.chars[charindex % len(self.chars)]
+-
+ 
+ class ToxReporter(tox._cmdline.Reporter):
+     actionchar = "+"
+ 
+     def _loopreport(self):
+-        filespinner = FileSpinner()
+         while 1:
+             eventlet.sleep(0.2)
+-            msg = []
++            activity_envs = {}
++
+             for action in self.session._actions:
+                 for popen in action._popenlist:
+                     if popen.poll() is None:
+-                        spinnchar = filespinner.getchar(popen.outpath)
+-                        if action.venv:
+-                            id = action.venv.envconfig.envname
+-                        else:
+-                            id = ""
+-                        msg.append("%s %s %s" % (
+-                            id, action.activity, spinnchar))
+-            if msg:
+-                self.tw.reline("   ".join(msg))
++                        l = activity_envs.setdefault(action.activity, set())
++                        l.add(action.id)
++            if activity_envs:
++                msg = ' '.join('%s {%s}'%(activity,' '.join(sorted(envnames)))
++                               for activity, envnames in activity_envs.items())
++                self.tw.reline('%s %s'%(msg, next(spin_chars) ), remove=True)
+ 
+     def __getattr__(self, name):
+         if name[0] == "_":
+report-activity-group
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.