Commits

holger krekel  committed 194ad0f

adapt to latest tox changes

  • Participants
  • Parent commits df3ccae

Comments (0)

Files changed (4)

File detox/main.py

     if args is None:
         args = sys.argv[1:]
     config = parse(args)
+    #now = py.std.time.time()
     detox = Detox(config)
     detox.startloopreport()
-    return detox.runtestsmulti(config.envlist)
+    retcode = detox.runtestsmulti(config.envlist)
+    #elapsed = py.std.time.time() - now
+    #cumulated = detox.toxsession.report.cumulated_time
+    #detox.toxsession.report.line(
+    #    "detox speed-up: %.2f (elapsed %.2f, cumulated %.2f)" % (
+    #        cumulated / elapsed, elapsed, cumulated), bold=True)
+    return retcode

File detox/proc.py

     sortorder = ("runtests installdeps sdist-reinst sdist-inst sdist-make "
                  "create recreate".split())
 
+    def __init__(self, session):
+        super(ToxReporter, self).__init__(session)
+        self._actionmayfinish = set()
+
     def _loopreport(self):
         filespinner = FileSpinner()
         while 1:
                     if popen.poll() is None:
                         l = ac2popenlist.setdefault(action.activity, [])
                         l.append(popen)
+                if not action._popenlist and action in self._actionmayfinish:
+                    super(ToxReporter, self).logaction_finish(action)
+                    self._actionmayfinish.remove(action)
 
             for acname in self.sortorder:
                 try:
 
         def generic_report(*args):
             self._calls.append((name,)+args)
-            if self.config.opts.verbosity >= 2:
+            if self.config.option.verbosity >= 2:
                 print ("%s" %(self._calls[-1], ))
         return generic_report
 
+    def logaction_finish(self, action):
+        if action._popenlist:
+            # defer finishing output to spinner loop
+            self._actionmayfinish.add(action)
+        else:
+            super(ToxReporter, self).logaction_finish(action)
+
     #def logpopen(self, popen):
     #    self._tw.line(msg)
 
 
     def provide_venv(self, venvname):
         venv = self.toxsession.getvenv(venvname)
-        self.toxsession.setupenv(venv, None)
-        return venv
+        if self.toxsession.setupenv(venv):
+            return venv
+
+    def provide_installsdist(self, venvname, sdistpath):
+        venv = self.toxsession.getvenv(venvname)
+        return self.toxsession.installsdist(venv, sdistpath)
 
     def runtests(self, venvname):
+        if self.toxsession.config.option.sdistonly:
+            self._sdistpath = self.getresources("sdist")
+            return
         venv, sdist = self.getresources("venv:%s" % venvname, "sdist")
-        venv.install_sdist(sdist)
-        self.toxsession.runtestenv(venv, sdist, redirect=True)
+        self._sdistpath = sdist
+        if venv and sdist:
+            if self.toxsession.installsdist(venv, sdist):
+                self.toxsession.runtestenv(venv, sdist, redirect=True)
 
     def runtestsmulti(self, envlist):
         pool = GreenPool()
         for env in envlist:
             pool.spawn_n(self.runtests, env)
         pool.waitall()
-        retcode = self._toxsession._summary()
-        return retcode
+        if not self.toxsession.config.option.sdistonly:
+            retcode = self._toxsession._summary()
+            return retcode
 
     def getresources(self, *specs):
         return self._resources.getresources(*specs)
         self._resources = {}
 
     def _dispatchprovider(self, spec):
-        parts = spec.split(":", 1)
+        parts = spec.split(":")
         name = parts.pop(0)
         provider = getattr(self._providerbase, "provide_" + name)
         self._resources[spec] = res = provider(*parts)
                      'Programming Language :: Python',
                      'Programming Language :: Python :: 3'],
         packages=['detox', ],
-        install_requires=['tox>=1.4.dev9',
+        install_requires=['tox>=1.4.dev11',
             'py>=1.4.9.dev1', 'eventlet>=0.9.16',],
         entry_points={'console_scripts': 'detox=detox.main:main'},
     )

File tests/test_detox.py

     def test_runtests(self, cmd):
         result = cmd.rundetox("-e", "py", "-v")
         result.stdout.fnmatch_lines([
-            "*py*prepareenv*py*",
-            "*create:*",
+            "py*getenv*",
+            "py*create:*",
         ])