Repository: tox-dev/tox

Issue:
show packaging output
We should show packaging output when three level verbosity is passed in. This would help often with tracking down packaging issues. Three levels, as we reserve the first two as tox levels, two plus is verbosity for elements called by tox.

Discussion:

Patch:
diff --git a/docs/changelog/1042.bugfix.rst b/docs/changelog/1042.bugfix.rst
index 53bde7e2..14d27749 100644
--- a/docs/changelog/1042.bugfix.rst
+++ b/docs/changelog/1042.bugfix.rst
@@ -1,4 +1,4 @@
 session packages are now put inside a numbered directory (instead of prefix numbering it,
 because pip fails when wheels are not named according to
 `PEP-491 <https://www.python.org/dev/peps/pep-0491/#id9>`_, and prefix numbering messes with this)
-- by user:`gaborbernat`
+- by :user:`gaborbernat`
diff --git a/docs/changelog/1047.feature.rst b/docs/changelog/1047.feature.rst
new file mode 100644
index 00000000..074a3574
--- /dev/null
+++ b/docs/changelog/1047.feature.rst
@@ -0,0 +1,1 @@
+level three verbosity (``-vvv``) show the packaging output - by :user:`gaborbernat`
diff --git a/src/tox/package.py b/src/tox/package.py
index 45c88829..e75a9f18 100644
--- a/src/tox/package.py
+++ b/src/tox/package.py
@@ -143,10 +143,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:
@@ -195,7 +197,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):
@@ -238,7 +240,7 @@ def get_build_info(folder, report):
     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:
@@ -263,6 +265,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])
 
 
diff --git a/src/tox/venv.py b/src/tox/venv.py
index 12cd44cd..29d5b644 100755
--- a/src/tox/venv.py
+++ b/src/tox/venv.py
@@ -91,7 +91,7 @@ class CreationConfig:
         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)


Test patch:
diff --git a/tests/unit/test_package.py b/tests/unit/test_package.py
index 46014b5b..9c117eb4 100644
--- a/tests/unit/test_package.py
+++ b/tests/unit/test_package.py
@@ -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, result.out
+    assert "running egg_info" in result.out, result.out
+    assert "Writing example123-0.5{}setup.cfg".format(os.sep) in result.out, 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, result.out
+    assert "running egg_info" in result.out, result.out
+    assert "Writing example123-0.5{}setup.cfg".format(os.sep) in result.out, result.out