Skip to content

Commit

Permalink
level three verbosity shows packaging output #1047
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat committed Oct 9, 2018
1 parent 1eccb20 commit 56a86a2
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/changelog/1047.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
level three verbosity (```-vvv``) show the packaging output - by :user:`gaborbernat`
9 changes: 6 additions & 3 deletions src/tox/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,12 @@ def make_sdist_legacy(report, config, session):
with session.newaction(None, "packaging") as action:
action.setactivity("sdist-make", setup)
session.make_emptydir(config.distdir)
action.popen(
build_log = action.popen(
[sys.executable, setup, "sdist", "--formats=zip", "--dist-dir", config.distdir],
cwd=config.setupdir,
returnout=True,
)
report.verbosity2(build_log)
try:
return config.distdir.listdir()[0]
except py.error.ENOENT:
Expand Down Expand Up @@ -189,7 +191,7 @@ def build_isolated(config, report, session):
) as action:
package_venv.run_install_command(packages=build_requires_dep, action=action)
session.finishvenv(package_venv)
return perform_isolated_build(build_info, package_venv, session, config)
return perform_isolated_build(build_info, package_venv, session, config, report)


def get_build_info(folder, report):
Expand Down Expand Up @@ -232,7 +234,7 @@ def abort(message):
return BuildInfo(requires, module, "{}{}".format(module, obj))


def perform_isolated_build(build_info, package_venv, session, config):
def perform_isolated_build(build_info, package_venv, session, config, report):
with session.newaction(
package_venv, "perform-isolated-build", package_venv.envconfig.envdir
) as action:
Expand All @@ -257,6 +259,7 @@ def perform_isolated_build(build_info, package_venv, session, config):
action=action,
cwd=session.config.setupdir,
)
report.verbosity2(result)
return config.distdir.join(result.split("\n")[-2])


Expand Down
2 changes: 1 addition & 1 deletion src/tox/venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def matches_with_reason(self, other, deps_matches_subset=False):
if self_deps != other_deps:
if deps_matches_subset:
diff = other_deps - self_deps
if not diff:
if diff:
return False, "missing in previous {!r}".format(diff)
else:
return False, "{!r}!={!r}".format(self_deps, other_deps)
Expand Down
37 changes: 37 additions & 0 deletions tests/unit/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,3 +404,40 @@ def test_install_via_installpkg(mock_venv, initproj, cmd):
fake_package = base.ensure(".tox", "dist", "pkg123-0.1.zip")
result = cmd("-e", "py", "--notest", "--installpkg", str(fake_package.relto(base)))
assert result.ret == 0, result.out


def test_verbose_isolated_build(initproj, mock_venv, cmd):
initproj(
"example123-0.5",
filedefs={
"tox.ini": """
[tox]
isolated_build = true
""",
"pyproject.toml": """
[build-system]
requires = ["setuptools >= 35.0.2"]
build-backend = 'setuptools.build_meta'
""",
},
)
result = cmd("--sdistonly", "-vvv")
assert "running sdist" in result.out
assert "running egg_info" in result.out
assert "Writing example123-0.5/setup.cfg" in result.out


def test_verbose_legacy_build(initproj, mock_venv, cmd):
initproj(
"example123-0.5",
filedefs={
"tox.ini": """
[tox]
isolated_build = false
"""
},
)
result = cmd("--sdistonly", "-vvv")
assert "running sdist" in result.out
assert "running egg_info" in result.out
assert "Writing example123-0.5/setup.cfg" in result.out

0 comments on commit 56a86a2

Please sign in to comment.