From 6ccab1d394a1fbe55208739cc418b94a18edf1df Mon Sep 17 00:00:00 2001 From: Vladimir Vitvitskiy Date: Wed, 22 Apr 2015 02:11:23 +0300 Subject: fix issue #235, --installpkg is broken Problem ----------- Session result log requires `py.path.local` for the source distribution when setting header. Passing str. Testing --------- `tox.ini` configuration:: ``` [testenv:X] commands={posargs} [testenv:Y] commands={posargs} ``` # download sdist pip install -d . ranger # install with a newly built fox version tox -e X -- tox -e Y --installpkg ranger-0.9.tar.gz --notest --- tox/_cmdline.py | 13 ++++++++++++- tox/result.py | 11 ++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/tox/_cmdline.py b/tox/_cmdline.py index 4037283..5846c7c 100644 --- a/tox/_cmdline.py +++ b/tox/_cmdline.py @@ -423,7 +423,14 @@ class Session: return False def installpkg(self, venv, sdist_path): - self.resultlog.set_header(installpkg=sdist_path) + """Install source package in the specified virtual environment. + + :param :class:`tox._config.VenvConfig`: Destination environment + :param str sdist_path: Path to the source distribution. + :return: True if package installed otherwise False. + :rtype: bool + """ + self.resultlog.set_header(installpkg=py.path.local(sdist_path)) action = self.newaction(venv, "installpkg", sdist_path) with action: try: @@ -434,6 +441,10 @@ class Session: return False def sdist(self): + """ + :return: Path to the source distribution + :rtype: py.path.local + """ if not self.config.option.sdistonly and (self.config.sdistsrc or self.config.option.installpkg): sdist_path = self.config.option.installpkg diff --git a/tox/result.py b/tox/result.py index 9954044..ee5ad09 100644 --- a/tox/result.py +++ b/tox/result.py @@ -3,6 +3,7 @@ import py from tox import __version__ as toxver import json + class ResultLog: def __init__(self, dict=None): @@ -14,10 +15,13 @@ class ResultLog: self.dict["host"] = py.std.socket.getfqdn() def set_header(self, installpkg): + """ + :param py.path.local installpkg: Path ot the package. + """ self.dict["installpkg"] = dict( - md5=installpkg.computehash("md5"), - sha256=installpkg.computehash("sha256"), - basename=installpkg.basename, + md5=installpkg.computehash("md5"), + sha256=installpkg.computehash("sha256"), + basename=installpkg.basename, ) def get_envlog(self, name): @@ -32,6 +36,7 @@ class ResultLog: def loads_json(cls, data): return cls(json.loads(data)) + class EnvLog: def __init__(self, reportlog, name, dict): self.reportlog = reportlog -- cgit v1.2.1