From fc35dcd7521317f04f491f8135faea75f433e896 Mon Sep 17 00:00:00 2001 From: Nyiro Gergo Date: Thu, 14 Jan 2016 11:25:11 +0100 Subject: session.Reporter: delete _starttime at exit The __enter__ of with statement extend the action object with _starttime and assert if it had been already extended. Therefore the __exit__ should remove the extra attribute of the action. --- tox/session.py | 1 + 1 file changed, 1 insertion(+) (limited to 'tox/session.py') diff --git a/tox/session.py b/tox/session.py index ffb52d6..f97b365 100644 --- a/tox/session.py +++ b/tox/session.py @@ -252,6 +252,7 @@ class Reporter(object): # self.cumulated_time += duration self.verbosity2("%s finish: %s after %.2f seconds" % ( action.venvname, action.msg, duration), bold=True) + delattr(action, '_starttime') def startsummary(self): self.tw.sep("_", "summary") -- cgit v1.2.1 From 26370885293487883eb60cbedcff76a0c6dc938e Mon Sep 17 00:00:00 2001 From: Sachi King Date: Mon, 29 Feb 2016 15:45:11 +1100 Subject: Process minversion before all else Reading the tox.ini config file and processing it is done as one task, yet processing the minversion is done much later, as such if there is a bug fix in a newer version or a change that makes the tox.ini file incompatable with older versions tox will bail with a stack trace instead of a "Your tox is too old" message. This moves the version check as early as it can possibly be done, the very first value read out of tox.ini is minversion and it is immedeiatly compared to tox.__version__. --- tox/session.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'tox/session.py') diff --git a/tox/session.py b/tox/session.py index 93ef5d8..2ff4182 100644 --- a/tox/session.py +++ b/tox/session.py @@ -40,6 +40,10 @@ def main(args=None): raise SystemExit(retcode) except KeyboardInterrupt: raise SystemExit(2) + except tox.exception.MinVersionError as e: + r = Reporter(None) + r.error(e.message) + raise SystemExit(1) def show_help(config): @@ -233,6 +237,12 @@ class Reporter(object): self._reportedlines = [] # self.cumulated_time = 0.0 + def _get_verbosity(self): + if self.session: + return self.session.config.option.verbosity + else: + return 2 + def logpopen(self, popen, env): """ log information about the action.popen() created process. """ cmd = " ".join(map(str, popen.args)) @@ -257,11 +267,11 @@ class Reporter(object): self.tw.sep("_", "summary") def info(self, msg): - if self.session.config.option.verbosity >= 2: + if self._get_verbosity() >= 2: self.logline(msg) def using(self, msg): - if self.session.config.option.verbosity >= 1: + if self._get_verbosity() >= 1: self.logline("using %s" % (msg,), bold=True) def keyboard_interrupt(self): @@ -297,15 +307,15 @@ class Reporter(object): self.tw.line("%s" % msg, **opts) def verbosity0(self, msg, **opts): - if self.session.config.option.verbosity >= 0: + if self._get_verbosity() >= 0: self.logline("%s" % msg, **opts) def verbosity1(self, msg, **opts): - if self.session.config.option.verbosity >= 1: + if self._get_verbosity() >= 1: self.logline("%s" % msg, **opts) def verbosity2(self, msg, **opts): - if self.session.config.option.verbosity >= 2: + if self._get_verbosity() >= 2: self.logline("%s" % msg, **opts) # def log(self, msg): @@ -359,14 +369,6 @@ class Session: def runcommand(self): self.report.using("tox-%s from %s" % (tox.__version__, tox.__file__)) - if self.config.minversion: - minversion = NormalizedVersion(self.config.minversion) - toxversion = NormalizedVersion(tox.__version__) - if toxversion < minversion: - self.report.error( - "tox version is %s, required is at least %s" % ( - toxversion, minversion)) - raise SystemExit(1) if self.config.option.showconfig: self.showconfig() elif self.config.option.listenvs: -- cgit v1.2.1 From 6c44042ac2357850365c83e7f31be4d74dd2199f Mon Sep 17 00:00:00 2001 From: holger krekel Date: Mon, 20 Jun 2016 16:40:36 +0200 Subject: fix issue66 by introducing using default "python -m pip" and introducing list_dependencies_command. (Ted, Holger) --- tox/session.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tox/session.py') diff --git a/tox/session.py b/tox/session.py index 029b06b..1d51b92 100644 --- a/tox/session.py +++ b/tox/session.py @@ -537,8 +537,9 @@ class Session: # write out version dependency information action = self.newaction(venv, "envreport") with action: - pip = venv.getcommandpath("pip") - output = venv._pcall([str(pip), "freeze"], + python = venv.getcommandpath("python") + args = venv.envconfig.list_dependencies_command + output = venv._pcall(args, cwd=self.config.toxinidir, action=action) # the output contains a mime-header, skip it -- cgit v1.2.1 From 03dd843fba44bc2fad91da6f2f7bb828a98ab923 Mon Sep 17 00:00:00 2001 From: Oliver Bestwalter Date: Mon, 20 Jun 2016 17:18:50 +0200 Subject: make flakes pass --- tox/session.py | 1 - 1 file changed, 1 deletion(-) (limited to 'tox/session.py') diff --git a/tox/session.py b/tox/session.py index 1d51b92..cb5cc66 100644 --- a/tox/session.py +++ b/tox/session.py @@ -537,7 +537,6 @@ class Session: # write out version dependency information action = self.newaction(venv, "envreport") with action: - python = venv.getcommandpath("python") args = venv.envconfig.list_dependencies_command output = venv._pcall(args, cwd=self.config.toxinidir, -- cgit v1.2.1