Repository: conan-io/conan

Issue:
Warnings as errors for the test suite
I've come across #4518 where we were calling a function without the `output` argument (then it will use the `global_outputer` and print a warning). In order to avoid this kind of _typos_ we could use the warnings-as-errors approach for testing.

It is as easy as calling

```python
import warnings
warnings.filterwarnings("error")
```

and then all the warnings will turn into exceptions.


.... of course we must be sure that this line is only executed in testing, we can put it in `conans/tests/__init__.py`.

WDYT @conan-io/barbarians?


Discussion:

Patch:
diff --git a/conans/__init__.py b/conans/__init__.py
index db1eebd5e..d6e8367f1 100644
--- a/conans/__init__.py
+++ b/conans/__init__.py
@@ -20,3 +20,4 @@ SERVER_CAPABILITIES = [COMPLEX_SEARCH_CAPABILITY, REVISIONS]  # Server is always
 DEFAULT_REVISION_V1 = "0"
 
 __version__ = '1.14.0-dev'
+
diff --git a/conans/client/generators/cmake_paths.py b/conans/client/generators/cmake_paths.py
index 003a010b8..4748d4066 100644
--- a/conans/client/generators/cmake_paths.py
+++ b/conans/client/generators/cmake_paths.py
@@ -10,13 +10,25 @@ class CMakePathsGenerator(Generator):
 
     @property
     def content(self):
+        lines = []
         deps = DepsCppCmake(self.deps_build_info)
+        # The CONAN_XXX_ROOT variables are needed because the FindXXX.cmake or XXXConfig.cmake
+        # in a package could have been "patched" with the `cmake.patch_config_paths()`
+        # replacing absolute paths with CONAN_XXX_ROOT variables.
+        for dep_name, dep_cpp_info in self.deps_build_info.dependencies:
+            var_name = "CONAN_{}_ROOT".format(dep_name.upper())
+            deps = DepsCppCmake(dep_cpp_info)
+            lines.append('set({} {})'.format(var_name, deps.rootpath))
+
         # We want to prioritize the FindXXX.cmake files:
         # 1. First the files found in the packages
         # 2. The previously set (by default CMAKE_MODULE_PATH is empty)
         # 3. The "install_folder" ones, in case there is no FindXXX.cmake, try with the install dir
         #    if the user used the "cmake_find_package" will find the auto-generated
         # 4. The CMake installation dir/Modules ones.
-        return """set(CMAKE_MODULE_PATH {deps.build_paths} ${{CMAKE_MODULE_PATH}} ${{CMAKE_CURRENT_LIST_DIR}})
-set(CMAKE_PREFIX_PATH {deps.build_paths} ${{CMAKE_PREFIX_PATH}} ${{CMAKE_CURRENT_LIST_DIR}})
-""".format(deps=deps)
+        lines.append("set(CMAKE_MODULE_PATH {deps.build_paths} ${{CMAKE_MODULE_PATH}} "
+                     "${{CMAKE_CURRENT_LIST_DIR}})".format(deps=deps))
+        lines.append("set(CMAKE_PREFIX_PATH {deps.build_paths} ${{CMAKE_PREFIX_PATH}} "
+                     "${{CMAKE_CURRENT_LIST_DIR}})".format(deps=deps))
+
+        return "\n".join(lines)
diff --git a/conans/client/graph/graph_builder.py b/conans/client/graph/graph_builder.py
index caeab2a9a..5a23aacaa 100644
--- a/conans/client/graph/graph_builder.py
+++ b/conans/client/graph/graph_builder.py
@@ -106,17 +106,17 @@ class DepsGraphBuilder(object):
                                  % (scope, list(conanfile._conan_evaluated_requires.values()),
                                     list(conanfile.requires.values())))
 
-    def _load_deps(self,  dep_graph, node, down_reqs, down_ref, down_options,
+    def _load_deps(self, dep_graph, node, down_reqs, down_ref, down_options,
                    check_updates, update, remote_name, processed_profile):
-        """ loads a Conan object from the given file
+        """ expands the dependencies of the node, recursively
         param node: Node object to be expanded in this step
         down_reqs: the Requirements as coming from downstream, which can overwrite current
                     values
         param down_ref: ConanFileReference of who is depending on current node for this expansion
         """
-        # basic node configuration
+        # basic node configuration: calling configure() and requirements()
         new_reqs, new_options = self._config_node(dep_graph, node, down_reqs, down_ref, down_options)
-
+        # if there are version-ranges, resolve them before expanding each of the requirements
         self._resolve_deps(dep_graph, node, update, remote_name)
 
         # Expand each one of the current requirements
@@ -136,15 +136,19 @@ class DepsGraphBuilder(object):
         previous = node.public_deps.get(name)
         if require.private or require.build_require or not previous:
             # new node, must be added and expanded
+            # node -> new_node
             new_node = self._create_new_node(node, dep_graph, require, name,
                                              check_updates, update, remote_name,
                                              processed_profile)
 
+            # The closure of a new node starts with just itself
             new_node.public_closure = OrderedDict([(new_node.ref.name, new_node)])
             node.public_closure[name] = new_node
             if require.private or require.build_require:
+                # If the requirement is private (or build_require), a new public scope is defined
                 new_node.public_deps = node.public_closure
             else:
+                # But if it is a normal require, the public_deps scope is the same as its parent
                 new_node.public_deps = node.public_deps
 
                 # add this new node to the public deps
@@ -162,6 +166,7 @@ class DepsGraphBuilder(object):
                             new_options, check_updates, update,
                             remote_name, processed_profile)
         else:  # a public node already exist with this name
+            # This is closing a diamond, the node is existing in the public_deps scope
             alias_ref = dep_graph.aliased.get(require.ref)
             # Necessary to make sure that it is pointing to the correct aliased
             if alias_ref:
@@ -177,9 +182,18 @@ class DepsGraphBuilder(object):
                                      "    To change it, override it in your base requirements"
                                      % (node.ref, require.ref, previous.ref))
 
+            # The existing node now has as ancestors all the ancestors of this branch
             previous.ancestors.add(node.name)
+            previous.ancestors.update(node.ancestors)
             node.public_closure[name] = previous
             dep_graph.add_edge(node, previous, require.private, require.build_require)
+            # Update the closure of each dependent
+            for dep_node_name, dep_node in previous.public_deps.items():
+                if dep_node is previous:
+                    continue
+                if dep_node_name in previous.ancestors:
+                    dep_node.public_closure.update(previous.public_closure)
+
             # RECURSION!
             if self._recurse(previous.public_closure, new_reqs, new_options):
                 self._load_deps(dep_graph, previous, new_reqs, node.ref,
diff --git a/conans/client/graph/graph_manager.py b/conans/client/graph/graph_manager.py
index 9fb42d985..8e61481b1 100644
--- a/conans/client/graph/graph_manager.py
+++ b/conans/client/graph/graph_manager.py
@@ -109,7 +109,8 @@ class GraphManager(object):
         processed_profile = ProcessedProfile(profile, create_reference)
         ref = None
         if isinstance(reference, list):  # Install workspace with multiple root nodes
-            conanfile = self._loader.load_virtual(reference, processed_profile)
+            conanfile = self._loader.load_virtual(reference, processed_profile,
+                                                  scope_options=False)
             root_node = Node(ref, conanfile, recipe=RECIPE_VIRTUAL)
         elif isinstance(reference, ConanFileReference):
             if not self._cache.config.revisions_enabled and reference.revision is not None:
diff --git a/conans/client/tools/files.py b/conans/client/tools/files.py
index 250a2c458..bfb968001 100644
--- a/conans/client/tools/files.py
+++ b/conans/client/tools/files.py
@@ -322,6 +322,7 @@ def collect_libs(conanfile, folder=None):
                                           "times with a different file extension" % name)
                 else:
                     result.append(name)
+    result.sort()
     return result
 
 
@@ -369,5 +370,3 @@ def unix2dos(filepath):
 
 def dos2unix(filepath):
     _replace_with_separator(filepath, "\n")
-
-
diff --git a/conans/client/tools/scm.py b/conans/client/tools/scm.py
index 806daec6d..193a082be 100644
--- a/conans/client/tools/scm.py
+++ b/conans/client/tools/scm.py
@@ -343,10 +343,11 @@ class SVN(SCMBase):
                         return False
                 return True
         else:
-            import warnings
-            warnings.warn("SVN::is_pristine for SVN v{} (less than {}) is not implemented, it is"
-                          " returning not-pristine always because it cannot compare with"
-                          " checked out version.".format(self.version, SVN.API_CHANGE_VERSION))
+            if self._output:
+                self._output.warn("SVN::is_pristine for SVN v{} (less than {}) is not implemented,"
+                                  " it is returning not-pristine always because it cannot compare"
+                                  " with checked out version.".format(self.version,
+                                                                      SVN.API_CHANGE_VERSION))
             return False
 
     def get_revision(self):
diff --git a/conans/client/tools/win.py b/conans/client/tools/win.py
index a2687c3a7..be06bb82f 100644
--- a/conans/client/tools/win.py
+++ b/conans/client/tools/win.py
@@ -137,9 +137,6 @@ def msvc_build_command(settings, sln_path, targets=None, upgrade_project=True, b
                        output=None):
     """ Do both: set the environment variables and call the .sln build
     """
-    import warnings
-    warnings.warn("deprecated", DeprecationWarning)
-
     vcvars = vcvars_command(settings, force=force_vcvars, output=output)
     build = build_sln_command(settings, sln_path, targets, upgrade_project, build_type, arch,
                               parallel, toolset=toolset, platforms=platforms, output=output)
diff --git a/conans/model/editable_layout.py b/conans/model/editable_layout.py
index 3164c43f5..de8a5f796 100644
--- a/conans/model/editable_layout.py
+++ b/conans/model/editable_layout.py
@@ -2,7 +2,7 @@
 import os
 from collections import OrderedDict
 
-from six import StringIO
+import six
 from six.moves import configparser
 
 from conans.errors import ConanException
@@ -59,7 +59,10 @@ class EditableLayout(object):
 
             parser = configparser.ConfigParser(allow_no_value=True)
             parser.optionxform = str
-            parser.readfp(StringIO(content))
+            if six.PY3:
+                parser.read_string(content)
+            else:
+                parser.readfp(six.StringIO(content))
         except (configparser.Error, ConanException) as e:
             raise ConanException("Error parsing layout file '%s' (for reference '%s')\n%s" %
                                  (self._filepath, str(ref), str(e)))
diff --git a/conans/model/env_info.py b/conans/model/env_info.py
index e7b0bc193..b84cd75db 100644
--- a/conans/model/env_info.py
+++ b/conans/model/env_info.py
@@ -254,7 +254,7 @@ class DepsEnvInfo(EnvInfo):
                 else:
                     self.vars[varname] = merge_lists(self.vars[varname], [value])
             else:
-                logger.warn("DISCARDED variable %s=%s from %s" % (varname, value, pkg_name))
+                logger.warning("DISCARDED variable %s=%s from %s" % (varname, value, pkg_name))
 
     def update_deps_env_info(self, dep_env_info):
         assert isinstance(dep_env_info, DepsEnvInfo)
diff --git a/conans/server/rest/bottle_plugins/authorization_header.py b/conans/server/rest/bottle_plugins/authorization_header.py
index f70e062a0..7ee988023 100644
--- a/conans/server/rest/bottle_plugins/authorization_header.py
+++ b/conans/server/rest/bottle_plugins/authorization_header.py
@@ -1,6 +1,7 @@
 import inspect
 from abc import ABCMeta, abstractmethod
 
+import six
 from bottle import PluginError, request
 
 from conans.util.log import logger
@@ -30,7 +31,8 @@ class AuthorizationHeader(object):
 
     def apply(self, callback, context):
         """ Test if the original callback accepts a 'self.keyword' keyword. """
-        args = inspect.getargspec(context.callback)[0]
+        args = inspect.getfullargspec(context.callback)[0] if six.PY3 \
+            else inspect.getargspec(context.callback)[0]
         logger.debug("Call: %s" % str(callback))
         if self.keyword not in args:
             return callback
diff --git a/conans/util/files.py b/conans/util/files.py
index 1046ea6b0..472fa854e 100644
--- a/conans/util/files.py
+++ b/conans/util/files.py
@@ -62,7 +62,7 @@ def decode_text(text):
             return text.decode(decoder)
         except UnicodeDecodeError:
             continue
-    logger.warn("can't decode %s" % str(text))
+    logger.warning("can't decode %s" % str(text))
     return text.decode("utf-8", "ignore")  # Ignore not compatible characters
 
 
diff --git a/conans/util/windows.py b/conans/util/windows.py
index 3cb9e2497..1b95ffe8f 100644
--- a/conans/util/windows.py
+++ b/conans/util/windows.py
@@ -74,7 +74,7 @@ def path_shortener(path, short_paths):
 
     redirect = hashed_redirect(short_home, path)
     if not redirect:
-        logger.warn("Failed to create a deterministic short path in %s", short_home)
+        logger.warning("Failed to create a deterministic short path in %s", short_home)
         redirect = tempfile.mkdtemp(dir=short_home, prefix="")
 
     # Save the full path of the local cache directory where the redirect is from.
diff --git a/setup.py b/setup.py
index d5325d251..60daf9b85 100644
--- a/setup.py
+++ b/setup.py
@@ -31,6 +31,10 @@ if platform.system() == "Darwin":
     project_requirements.extend(get_requires("conans/requirements_osx.txt"))
 project_requirements.extend(get_requires("conans/requirements_server.txt"))
 dev_requirements = get_requires("conans/requirements_dev.txt")
+# The tests utils are used by conan-package-tools
+exclude_test_packages = ["conans.test.{}*".format(d)
+                         for d in os.listdir(os.path.join(here, "conans/test"))
+                         if os.path.isdir(os.path.join(here, "conans/test", d)) and d != "utils"]
 
 
 def load_version():
@@ -88,7 +92,7 @@ setup(
 
     # You can just specify the packages manually here if your project is
     # simple. Or you can use find_packages().
-    packages=find_packages(),
+    packages=find_packages(exclude=exclude_test_packages),
 
     # Alternatively, if you want to distribute just a my_module.py, uncomment
     # this:


Test patch:
diff --git a/conans/test/__init__.py b/conans/test/__init__.py
index 32f47da43..90bc78fb5 100644
--- a/conans/test/__init__.py
+++ b/conans/test/__init__.py
@@ -1,4 +1,8 @@
 import os
+import warnings
 
 CONAN_TEST_FOLDER = os.getenv('CONAN_TEST_FOLDER', None)
 os.environ["CONAN_RECIPE_LINTER"] = "False"
+
+# Enable warnings as errors only for `conan[s]` module
+warnings.filterwarnings("error", module="conan.*")
diff --git a/conans/test/functional/generators/cmake_paths_test.py b/conans/test/functional/generators/cmake_paths_test.py
index f36ca057f..0852d10fa 100644
--- a/conans/test/functional/generators/cmake_paths_test.py
+++ b/conans/test/functional/generators/cmake_paths_test.py
@@ -2,7 +2,8 @@ import os
 import shutil
 import unittest
 
-from conans.test.utils.tools import TestClient
+from conans.model.ref import ConanFileReference, PackageReference
+from conans.test.utils.tools import TestClient, NO_SETTINGS_PACKAGE_ID
 
 
 class CMakePathsGeneratorTest(unittest.TestCase):
@@ -24,6 +25,7 @@ class TestConan(ConanFile):
                  "FindHello0.cmake": """
 SET(Hello0_FOUND 1)
 MESSAGE("HELLO FROM THE Hello0 FIND PACKAGE!")
+MESSAGE("ROOT PATH: ${CONAN_HELLO0_ROOT}")
 """}
         client.save(files)
         client.run("create . user/channel")
@@ -55,6 +57,11 @@ find_package(Hello0 REQUIRED)
                             cwd=build_dir)
         self.assertEqual(ret, 0)
         self.assertIn("HELLO FROM THE Hello0 FIND PACKAGE!", client.out)
+        ref = ConanFileReference.loads("Hello0/0.1@user/channel")
+        pref = PackageReference(ref, NO_SETTINGS_PACKAGE_ID)
+        package_folder = client.cache.package_layout(ref).package(pref)
+        # Check that the CONAN_HELLO0_ROOT has been replaced with the real abs path
+        self.assertIn("ROOT PATH: %s" % package_folder.replace("\\", "/"), client.out)
 
         # Now try without toolchain but including the file
         files = {"CMakeLists.txt": """
diff --git a/conans/test/functional/graph/graph_manager_test.py b/conans/test/functional/graph/graph_manager_test.py
index 5f15aaa1d..0709e7441 100644
--- a/conans/test/functional/graph/graph_manager_test.py
+++ b/conans/test/functional/graph/graph_manager_test.py
@@ -1,110 +1,11 @@
-import os
-import unittest
-
 import six
-from mock import Mock
 from parameterized import parameterized
 
-from conans.client.cache.cache import ClientCache
 from conans.client.graph.graph import RECIPE_CONSUMER, RECIPE_INCACHE
-from conans.client.graph.graph_manager import GraphManager
-from conans.client.graph.proxy import ConanProxy
-from conans.client.graph.python_requires import ConanPythonRequire
-from conans.client.graph.range_resolver import RangeResolver
-from conans.client.installer import BinaryInstaller
-from conans.client.loader import ConanFileLoader
-from conans.client.recorder.action_recorder import ActionRecorder
 from conans.errors import ConanException
-from conans.model.graph_info import GraphInfo
-from conans.model.manifest import FileTreeManifest
-from conans.model.options import OptionsValues
-from conans.model.profile import Profile
 from conans.model.ref import ConanFileReference
-from conans.test.unittests.model.transitive_reqs_test import MockSearchRemote
+from conans.test.functional.graph.graph_manager_base import GraphManagerTest
 from conans.test.utils.conanfile import TestConanFile
-from conans.test.utils.test_files import temp_folder
-from conans.test.utils.tools import TestBufferConanOutput
-from conans.util.files import save
-
-
-class GraphManagerTest(unittest.TestCase):
-
-    def setUp(self):
-        self.output = TestBufferConanOutput()
-        cache_folder = temp_folder()
-        cache = ClientCache(cache_folder, os.path.join(cache_folder, ".conan"), self.output)
-        self.cache = cache
-        self.remote_search = MockSearchRemote()
-        remote_manager = None
-        self.resolver = RangeResolver(cache, self.remote_search)
-        proxy = ConanProxy(cache, self.output, remote_manager)
-        self.loader = ConanFileLoader(None, self.output, ConanPythonRequire(None, None))
-        self.manager = GraphManager(self.output, cache, remote_manager, self.loader, proxy,
-                                    self.resolver)
-        hook_manager = Mock()
-        recorder = Mock()
-        self.binary_installer = BinaryInstaller(cache, self.output, remote_manager, recorder,
-                                                hook_manager)
-
-    def _cache_recipe(self, reference, test_conanfile, revision=None):
-        if isinstance(test_conanfile, TestConanFile):
-            test_conanfile.info = True
-        ref = ConanFileReference.loads(reference)
-        save(self.cache.conanfile(ref), str(test_conanfile))
-        with self.cache.package_layout(ref).update_metadata() as metadata:
-            metadata.recipe.revision = revision or "123"
-        manifest = FileTreeManifest.create(self.cache.export(ref))
-        manifest.save(self.cache.export(ref))
-
-    def build_graph(self, content, profile_build_requires=None, ref=None):
-        path = temp_folder()
-        path = os.path.join(path, "conanfile.py")
-        save(path, str(content))
-        self.loader.cached_conanfiles = {}
-
-        profile = Profile()
-        if profile_build_requires:
-            profile.build_requires = profile_build_requires
-        profile.process_settings(self.cache)
-        update = check_updates = False
-        recorder = ActionRecorder()
-        remote_name = None
-        build_mode = []
-        ref = ref or ConanFileReference(None, None, None, None, validate=False)
-        options = OptionsValues()
-        graph_info = GraphInfo(profile, options, root_ref=ref)
-        deps_graph, _ = self.manager.load_graph(path, None, graph_info,
-                                                build_mode, check_updates, update,
-                                                remote_name, recorder)
-        self.binary_installer.install(deps_graph, False, graph_info)
-        return deps_graph
-
-    def _check_node(self, node, ref, deps, build_deps, dependents, closure, public_deps):
-        conanfile = node.conanfile
-        ref = ConanFileReference.loads(str(ref))
-        self.assertEqual(node.ref.full_repr(), ref.full_repr())
-        self.assertEqual(conanfile.name, ref.name)
-        self.assertEqual(len(node.dependencies), len(deps) + len(build_deps))
-        self.assertEqual(len(node.dependants), len(dependents))
-
-        public_deps = {n.name: n for n in public_deps}
-        self.assertEqual(node.public_deps, public_deps)
-
-        # The recipe requires is resolved to the reference WITH revision!
-        self.assertEqual(len(deps), len(conanfile.requires))
-        for dep in deps:
-            self.assertEqual(conanfile.requires[dep.name].ref,
-                             dep.ref)
-
-        self.assertEqual(closure, node.public_closure)
-        libs = []
-        envs = []
-        for n in closure:
-            libs.append("mylib%s%slib" % (n.ref.name, n.ref.version))
-            envs.append("myenv%s%senv" % (n.ref.name, n.ref.version))
-        self.assertEqual(conanfile.deps_cpp_info.libs, libs)
-        env = {"MYENV": envs} if envs else {}
-        self.assertEqual(conanfile.deps_env_info.vars, env)
 
 
 class TransitiveGraphTest(GraphManagerTest):
@@ -191,6 +92,151 @@ class TransitiveGraphTest(GraphManagerTest):
         self._check_node(liba, "liba/0.1@user/testing#123", deps=[], build_deps=[],
                          dependents=[libb, libc], closure=[], public_deps=[app, libb, libc, liba])
 
+    def test_consecutive_diamonds(self):
+        # app -> libe0.1 -> libd0.1 -> libb0.1 -> liba0.1
+        #    \-> libf0.1 ->/    \-> libc0.1 ->/
+        liba_ref = "liba/0.1@user/testing"
+        libb_ref = "libb/0.1@user/testing"
+        libc_ref = "libc/0.1@user/testing"
+        libd_ref = "libd/0.1@user/testing"
+        libe_ref = "libe/0.1@user/testing"
+        libf_ref = "libf/0.1@user/testing"
+        self._cache_recipe(liba_ref, TestConanFile("liba", "0.1"))
+        self._cache_recipe(libb_ref, TestConanFile("libb", "0.1", requires=[liba_ref]))
+        self._cache_recipe(libc_ref, TestConanFile("libc", "0.1", requires=[liba_ref]))
+        self._cache_recipe(libd_ref, TestConanFile("libd", "0.1", requires=[libb_ref, libc_ref]))
+        self._cache_recipe(libe_ref, TestConanFile("libe", "0.1", requires=[libd_ref]))
+        self._cache_recipe(libf_ref, TestConanFile("libf", "0.1", requires=[libd_ref]))
+        deps_graph = self.build_graph(TestConanFile("app", "0.1", requires=[libe_ref, libf_ref]))
+
+        self.assertEqual(7, len(deps_graph.nodes))
+        app = deps_graph.root
+        libe = app.dependencies[0].dst
+        libf = app.dependencies[1].dst
+        libd = libe.dependencies[0].dst
+        libb = libd.dependencies[0].dst
+        libc = libd.dependencies[1].dst
+        liba = libc.dependencies[0].dst
+
+        public_deps = [app, libb, libc, liba, libd, libe, libf]
+        self._check_node(app, "app/0.1@None/None", deps=[libe, libf], build_deps=[], dependents=[],
+                         closure=[libe, libf, libd, libb, libc, liba], public_deps=public_deps)
+        self._check_node(libe, "libe/0.1@user/testing#123", deps=[libd], build_deps=[],
+                         dependents=[app], closure=[libd, libb, libc, liba],
+                         public_deps=public_deps)
+        self._check_node(libf, "libf/0.1@user/testing#123", deps=[libd], build_deps=[],
+                         dependents=[app], closure=[libd, libb, libc, liba],
+                         public_deps=public_deps)
+        self._check_node(libd, "libd/0.1@user/testing#123", deps=[libb, libc], build_deps=[],
+                         dependents=[libe, libf], closure=[libb, libc, liba],
+                         public_deps=public_deps)
+        self._check_node(libb, "libb/0.1@user/testing#123", deps=[liba], build_deps=[],
+                         dependents=[app], closure=[liba], public_deps=public_deps)
+        self._check_node(libb, "libb/0.1@user/testing#123", deps=[liba], build_deps=[],
+                         dependents=[app], closure=[liba], public_deps=public_deps)
+        self._check_node(liba, "liba/0.1@user/testing#123", deps=[], build_deps=[],
+                         dependents=[libb, libc], closure=[], public_deps=public_deps)
+
+    def test_parallel_diamond(self):
+        # app -> libb0.1 -> liba0.1
+        #    \-> libc0.1 ->/
+        #    \-> libd0.1 ->/
+        liba_ref = "liba/0.1@user/testing"
+        libb_ref = "libb/0.1@user/testing"
+        libc_ref = "libc/0.1@user/testing"
+        libd_ref = "libd/0.1@user/testing"
+        self._cache_recipe(liba_ref, TestConanFile("liba", "0.1"))
+        self._cache_recipe(libb_ref, TestConanFile("libb", "0.1", requires=[liba_ref]))
+        self._cache_recipe(libc_ref, TestConanFile("libc", "0.1", requires=[liba_ref]))
+        self._cache_recipe(libd_ref, TestConanFile("libd", "0.1", requires=[liba_ref]))
+        deps_graph = self.build_graph(TestConanFile("app", "0.1",
+                                                    requires=[libb_ref, libc_ref, libd_ref]))
+
+        self.assertEqual(5, len(deps_graph.nodes))
+        app = deps_graph.root
+        libb = app.dependencies[0].dst
+        libc = app.dependencies[1].dst
+        libd = app.dependencies[2].dst
+        liba = libb.dependencies[0].dst
+
+        public_deps = [app, libb, libc, liba, libd]
+        self._check_node(app, "app/0.1@None/None", deps=[libb, libc, libd], build_deps=[],
+                         dependents=[], closure=[libb, libc, libd, liba], public_deps=public_deps)
+        self._check_node(libb, "libb/0.1@user/testing#123", deps=[liba], build_deps=[],
+                         dependents=[app], closure=[liba], public_deps=public_deps)
+        self._check_node(libc, "libc/0.1@user/testing#123", deps=[liba], build_deps=[],
+                         dependents=[app], closure=[liba], public_deps=public_deps)
+        self._check_node(libd, "libd/0.1@user/testing#123", deps=[liba], build_deps=[],
+                         dependents=[app], closure=[liba], public_deps=public_deps)
+        self._check_node(liba, "liba/0.1@user/testing#123", deps=[], build_deps=[],
+                         dependents=[libb, libc, libd], closure=[], public_deps=public_deps)
+
+    def test_nested_diamond(self):
+        # app --------> libb0.1 -> liba0.1
+        #    \--------> libc0.1 ->/
+        #     \-> libd0.1 ->/
+        liba_ref = "liba/0.1@user/testing"
+        libb_ref = "libb/0.1@user/testing"
+        libc_ref = "libc/0.1@user/testing"
+        libd_ref = "libd/0.1@user/testing"
+        self._cache_recipe(liba_ref, TestConanFile("liba", "0.1"))
+        self._cache_recipe(libb_ref, TestConanFile("libb", "0.1", requires=[liba_ref]))
+        self._cache_recipe(libc_ref, TestConanFile("libc", "0.1", requires=[liba_ref]))
+        self._cache_recipe(libd_ref, TestConanFile("libd", "0.1", requires=[libc_ref]))
+        deps_graph = self.build_graph(TestConanFile("app", "0.1",
+                                                    requires=[libb_ref, libc_ref, libd_ref]))
+
+        self.assertEqual(5, len(deps_graph.nodes))
+        app = deps_graph.root
+        libb = app.dependencies[0].dst
+        libc = app.dependencies[1].dst
+        libd = app.dependencies[2].dst
+        liba = libb.dependencies[0].dst
+
+        public_deps = [app, libb, libc, liba, libd]
+        self._check_node(app, "app/0.1@None/None", deps=[libb, libc, libd], build_deps=[],
+                         dependents=[], closure=[libb, libd, libc, liba], public_deps=public_deps)
+        self._check_node(libb, "libb/0.1@user/testing#123", deps=[liba], build_deps=[],
+                         dependents=[app], closure=[liba], public_deps=public_deps)
+        self._check_node(libc, "libc/0.1@user/testing#123", deps=[liba], build_deps=[],
+                         dependents=[app, libd], closure=[liba], public_deps=public_deps)
+        self._check_node(libd, "libd/0.1@user/testing#123", deps=[libc], build_deps=[],
+                         dependents=[app], closure=[libc, liba], public_deps=public_deps)
+        self._check_node(liba, "liba/0.1@user/testing#123", deps=[], build_deps=[],
+                         dependents=[libb, libc], closure=[], public_deps=public_deps)
+
+    def test_multiple_transitive(self):
+        # https://github.com/conanio/conan/issues/4720
+        # app -> libb0.1  -> libc0.1 -> libd0.1
+        #    \--------------->/          /
+        #     \------------------------>/
+        libb_ref = "libb/0.1@user/testing"
+        libc_ref = "libc/0.1@user/testing"
+        libd_ref = "libd/0.1@user/testing"
+        self._cache_recipe(libd_ref, TestConanFile("libd", "0.1"))
+        self._cache_recipe(libc_ref, TestConanFile("libc", "0.1", requires=[libd_ref]))
+        self._cache_recipe(libb_ref, TestConanFile("libb", "0.1", requires=[libc_ref]))
+        deps_graph = self.build_graph(TestConanFile("liba", "0.1",
+                                                    requires=[libd_ref, libc_ref, libb_ref]))
+
+        self.assertEqual(4, len(deps_graph.nodes))
+        liba = deps_graph.root
+        libd = liba.dependencies[0].dst
+        libc = liba.dependencies[1].dst
+        libb = liba.dependencies[2].dst
+
+        self._check_node(libd, "libd/0.1@user/testing#123", deps=[], build_deps=[],
+                         dependents=[libb, libc], closure=[], public_deps=[liba, libb, libc, libd])
+        self._check_node(liba, "liba/0.1@None/None", deps=[libd, libc, libb], build_deps=[],
+                         dependents=[],
+                         closure=[libb, libc, libd], public_deps=[liba, libb, libc, libd])
+        self._check_node(libb, "libb/0.1@user/testing#123", deps=[libc], build_deps=[],
+                         dependents=[liba], closure=[libc, libd],
+                         public_deps=[liba, libb, libc, libd])
+        self._check_node(libc, "libc/0.1@user/testing#123", deps=[libd], build_deps=[],
+                         dependents=[liba, libb], closure=[libd],
+                         public_deps=[liba, libb, libc, libd])
+
     def test_diamond_conflict(self):
         # app -> libb0.1 -> liba0.1
         #    \-> libc0.1 -> liba0.2
diff --git a/conans/test/functional/graph/transitive_deps_test.py b/conans/test/functional/graph/transitive_deps_test.py
new file mode 100644
index 000000000..2a59107f4
--- /dev/null
+++ b/conans/test/functional/graph/transitive_deps_test.py
@@ -0,0 +1,48 @@
+# coding=utf-8
+
+import os
+import unittest
+
+from parameterized import parameterized
+
+from conans.model.ref import PackageReference
+from conans.test.utils.conanfile import TestConanFile
+from conans.test.utils.tools import TestClient
+from conans.util.files import load
+
+
+class TransitiveDepsTest(unittest.TestCase):
+
+    def setUp(self):
+        # Create dependency graph: C -> B -> A
+        self.t = TestClient()
+
+        self.t.save({"A/conanfile.py": str(TestConanFile("AAAA", "1.0"))})
+        self.t.run("export A user/channel")
+
+        self.t.save({"B/conanfile.py": str(TestConanFile("BBBB", "1.0",
+                                                         requires=["AAAA/1.0@user/channel"]))})
+        self.t.run("export B user/channel")
+        self.t.save({"C/conanfile.py":
+                     str(TestConanFile("CCCC", "1.0", requires=["BBBB/1.0@user/channel"])) +
+                    "    generators='cmake'"})
+        self.t.run("export C user/channel")
+
+    @parameterized.expand([(True, ), (False, )])
+    def test_consume(self, inverse_order):
+        deps = sorted(["AAAA/1.0@user/channel", "CCCC/1.0@user/channel"], reverse=inverse_order)
+
+        # Create D -> A,C
+        self.t.save({"D/conanfile.py": str(TestConanFile("DDDD", "1.0",
+                                                         requires=deps))})
+        self.t.run("create ./D user/channel --build=missing")
+
+        # C is being built
+        pref_c = PackageReference.loads(
+            "CCCC/1.0@user/channel:aef99e6ca67e3d2da47927c4ec1ec7129129943f")
+        self.assertIn("{} - Build".format(pref_c), self.t.out)
+        build_folder = self.t.cache.build(pref=pref_c)
+
+        # It contains information about AAAA
+        conanbuildinfo = load(os.path.join(build_folder, "conanbuildinfo.cmake"))
+        self.assertIn("set(CONAN_AAAA_ROOT ", conanbuildinfo)
diff --git a/conans/test/functional/workspace/workspace_test.py b/conans/test/functional/workspace/workspace_test.py
index 8e1d5abde..c326ade1e 100644
--- a/conans/test/functional/workspace/workspace_test.py
+++ b/conans/test/functional/workspace/workspace_test.py
@@ -188,6 +188,96 @@ class WorkspaceTest(unittest.TestCase):
             for f in ("conanbuildinfo.cmake", "conaninfo.txt", "conanbuildinfo.txt"):
                 self.assertTrue(os.path.exists(os.path.join(client.current_folder, sub, f)))
 
+    def multiple_roots_test(self):
+        # https://github.com/conan-io/conan/issues/4720
+        client = TestClient()
+
+        def files(name, depend=None):
+            deps = ('"Hello%s/0.1@lasote/stable"' % depend) if depend else "None"
+            return {"conanfile.py": conanfile_build.format(deps=deps, name=name)}
+
+        client.save(files("D"), path=os.path.join(client.current_folder, "D"))
+        client.save(files("C", "D"), path=os.path.join(client.current_folder, "C"))
+        client.save(files("A", "C"), path=os.path.join(client.current_folder, "A"))
+        client.save(files("B", "D"), path=os.path.join(client.current_folder, "B"))
+
+        project = dedent("""
+            editables:
+                HelloD/0.1@lasote/stable:
+                    path: D
+                HelloB/0.1@lasote/stable:
+                    path: B
+                HelloC/0.1@lasote/stable:
+                    path: C
+                HelloA/0.1@lasote/stable:
+                    path: A
+            layout: layout
+            root: HelloA/0.1@lasote/stable, HelloB/0.1@lasote/stable
+            """)
+        layout = dedent("""
+            [build_folder]
+
+            """)
+        client.save({"conanws.yml": project,
+                     "layout": layout})
+        client.run("workspace install conanws.yml")
+        self.assertIn("HelloA/0.1@lasote/stable from user folder - Editable", client.out)
+        self.assertIn("HelloB/0.1@lasote/stable from user folder - Editable", client.out)
+        self.assertIn("HelloC/0.1@lasote/stable from user folder - Editable", client.out)
+        self.assertIn("HelloD/0.1@lasote/stable from user folder - Editable", client.out)
+
+        a_cmake = load(os.path.join(client.current_folder, "A", "conanbuildinfo.cmake"))
+        self.assertIn("set(CONAN_LIBS helloC helloD ${CONAN_LIBS})", a_cmake)
+        b_cmake = load(os.path.join(client.current_folder, "B", "conanbuildinfo.cmake"))
+        self.assertIn("set(CONAN_LIBS helloD ${CONAN_LIBS})", b_cmake)
+
+    def transitivity_test(self):
+        # https://github.com/conan-io/conan/issues/4720
+        client = TestClient()
+
+        def files(name, depend=None):
+            if isinstance(depend, list):
+                deps = ", ".join(["'Hello%s/0.1@lasote/stable'" % d for d in depend])
+            else:
+                deps = ('"Hello%s/0.1@lasote/stable"' % depend) if depend else "None"
+            return {"conanfile.py": conanfile_build.format(deps=deps, name=name)}
+
+        client.save(files("D"), path=os.path.join(client.current_folder, "D"))
+        client.save(files("C", "D"), path=os.path.join(client.current_folder, "C"))
+        client.save(files("B", "C"), path=os.path.join(client.current_folder, "B"))
+
+        client.save(files("A", ["D", "C", "B"]), path=os.path.join(client.current_folder, "A"))
+
+        project = dedent("""
+            editables:
+                HelloD/0.1@lasote/stable:
+                    path: D
+                HelloB/0.1@lasote/stable:
+                    path: B
+                HelloC/0.1@lasote/stable:
+                    path: C
+                HelloA/0.1@lasote/stable:
+                    path: A
+            layout: layout
+            root: HelloA/0.1@lasote/stable
+            """)
+        layout = dedent("""
+            [build_folder]
+
+            """)
+        client.save({"conanws.yml": project,
+                     "layout": layout})
+        client.run("workspace install conanws.yml")
+        self.assertIn("HelloA/0.1@lasote/stable from user folder - Editable", client.out)
+        self.assertIn("HelloB/0.1@lasote/stable from user folder - Editable", client.out)
+        self.assertIn("HelloC/0.1@lasote/stable from user folder - Editable", client.out)
+        self.assertIn("HelloD/0.1@lasote/stable from user folder - Editable", client.out)
+
+        a_cmake = load(os.path.join(client.current_folder, "A", "conanbuildinfo.cmake"))
+        self.assertIn("set(CONAN_LIBS helloB helloC helloD ${CONAN_LIBS})", a_cmake)
+        b_cmake = load(os.path.join(client.current_folder, "B", "conanbuildinfo.cmake"))
+        self.assertIn("set(CONAN_LIBS helloC helloD ${CONAN_LIBS})", b_cmake)
+
     def simple_build_test(self):
         client = TestClient()
 
diff --git a/conans/test/integration/syncronize_test.py b/conans/test/integration/syncronize_test.py
index 7790d34f2..00b39be42 100644
--- a/conans/test/integration/syncronize_test.py
+++ b/conans/test/integration/syncronize_test.py
@@ -126,7 +126,7 @@ class SynchronizeTest(unittest.TestCase):
         # With revisions makes no sense because there is a new revision always that sources change
         if not client.cache.config.revisions_enabled:
             self.assertFalse(os.path.exists(remote_file_path))
-            self.assertNotEquals(remote_file_path, new_file_source_path)
+            self.assertNotEqual(remote_file_path, new_file_source_path)
 
     def _create_manifest(self, client, package_reference):
         # Create the manifest to be able to upload the package
diff --git a/conans/test/unittests/client/generators/cmake_paths_test.py b/conans/test/unittests/client/generators/cmake_paths_test.py
index e090608d0..8a28ec4eb 100644
--- a/conans/test/unittests/client/generators/cmake_paths_test.py
+++ b/conans/test/unittests/client/generators/cmake_paths_test.py
@@ -25,15 +25,11 @@ class CMakePathsGeneratorTest(unittest.TestCase):
         conanfile.deps_cpp_info.update(cpp_info, "MyLib")
 
         generator = CMakePathsGenerator(conanfile)
-        cmake_lines = [s.replace("\t\t\t", "").replace('\\', '/')
-                       for s in generator.content.splitlines()]
-        self.assertEqual('set(CMAKE_MODULE_PATH '
-                          '"%s/"' % tmp.replace('\\', '/'), cmake_lines[0])
-        self.assertEqual('"%s" ${CMAKE_MODULE_PATH} '
-                          '${CMAKE_CURRENT_LIST_DIR})' % custom_dir.replace('\\', '/'),
-                          cmake_lines[1])
-        self.assertEqual('set(CMAKE_PREFIX_PATH '
-                          '"%s/"' % tmp.replace('\\', '/'), cmake_lines[2])
-        self.assertEqual('"%s" ${CMAKE_PREFIX_PATH} '
-                          '${CMAKE_CURRENT_LIST_DIR})' % custom_dir.replace('\\', '/'),
-                          cmake_lines[3])
+        path = tmp.replace('\\', '/')
+        custom_dir = custom_dir.replace('\\', '/')
+        cmake_lines = generator.content.replace('\\', '/').replace("\n\t\t\t", " ").splitlines()
+        self.assertEquals('set(CONAN_MYLIB_ROOT "%s")' % path, cmake_lines[0])
+        self.assertEquals('set(CMAKE_MODULE_PATH "%s/" "%s" ${CMAKE_MODULE_PATH} '
+                          '${CMAKE_CURRENT_LIST_DIR})' % (path, custom_dir), cmake_lines[1])
+        self.assertEquals('set(CMAKE_PREFIX_PATH "%s/" "%s" ${CMAKE_PREFIX_PATH} '
+                          '${CMAKE_CURRENT_LIST_DIR})' % (path, custom_dir), cmake_lines[2])
diff --git a/conans/test/optimize_conanfile_load_test.py b/conans/test/unittests/client/optimize_conanfile_load_test.py
similarity index 100%
rename from conans/test/optimize_conanfile_load_test.py
rename to conans/test/unittests/client/optimize_conanfile_load_test.py
diff --git a/conans/test/unittests/model/build_info/cppflags_test.py b/conans/test/unittests/model/build_info/cppflags_test.py
index c702a6384..53fdce743 100644
--- a/conans/test/unittests/model/build_info/cppflags_test.py
+++ b/conans/test/unittests/model/build_info/cppflags_test.py
@@ -1,6 +1,8 @@
 # coding=utf-8
 
 import unittest
+import warnings
+
 from conans.model.build_info import _CppInfo
 
 
@@ -9,24 +11,38 @@ class CppFlagsTest(unittest.TestCase):
 
     def test_use_cxxflags(self):
         """ Changes in cxxflags get reflected in cppflags """
-        cpp_info = _CppInfo()
 
-        cpp_info.cxxflags = "flags"
-        self.assertEqual(cpp_info.cppflags, "flags")
-        self.assertEqual(cpp_info.cxxflags, cpp_info.cppflags)
+        with warnings.catch_warnings(record=True) as w:
+            warnings.simplefilter("always")
+
+            cpp_info = _CppInfo()
+            cpp_info.cxxflags = "flags"
+            self.assertEqual(cpp_info.cppflags, "flags")
+            self.assertEqual(cpp_info.cxxflags, cpp_info.cppflags)
 
-        cpp_info.cxxflags = None
-        self.assertEqual(cpp_info.cppflags, None)
-        self.assertEqual(cpp_info.cxxflags, cpp_info.cppflags)
+            cpp_info.cxxflags = None
+            self.assertEqual(cpp_info.cppflags, None)
+            self.assertEqual(cpp_info.cxxflags, cpp_info.cppflags)
+
+            self.assertEqual(len(w), 4)
+            self.assertTrue(issubclass(w[0].category, DeprecationWarning))
 
     def test_use_cppflags(self):
         """ Changes in cppflags get reflected in cxxflags """
-        cpp_info = _CppInfo()
 
-        cpp_info.cppflags = "flags"
-        self.assertEqual(cpp_info.cxxflags, "flags")
-        self.assertEqual(cpp_info.cxxflags, cpp_info.cppflags)
+        with warnings.catch_warnings(record=True) as w:
+            warnings.simplefilter("always")
+
+            cpp_info = _CppInfo()
+
+            cpp_info.cppflags = "flags"
+            self.assertEqual(cpp_info.cxxflags, "flags")
+            self.assertEqual(cpp_info.cxxflags, cpp_info.cppflags)
+
+            cpp_info.cppflags = None
+            self.assertEqual(cpp_info.cxxflags, None)
+            self.assertEqual(cpp_info.cxxflags, cpp_info.cppflags)
+
+            self.assertEqual(len(w), 4)
+            self.assertTrue(issubclass(w[0].category, DeprecationWarning))
 
-        cpp_info.cppflags = None
-        self.assertEqual(cpp_info.cxxflags, None)
-        self.assertEqual(cpp_info.cxxflags, cpp_info.cppflags)
diff --git a/conans/test/unittests/model/profile_test.py b/conans/test/unittests/model/profile_test.py
index 82c0c71b9..729c67516 100644
--- a/conans/test/unittests/model/profile_test.py
+++ b/conans/test/unittests/model/profile_test.py
@@ -48,10 +48,10 @@ compiler.runtime=MT
                                                  ("other", "value")]))
 
         self.assertEqual(dict(new_profile.settings), {"compiler": "Visual Studio",
-                                                       "os": "Windows",
-                                                       "compiler.runtime": "MT",
-                                                       "compiler.subsetting": "3",
-                                                       "other": "value"})
+                                                      "os": "Windows",
+                                                      "compiler.runtime": "MT",
+                                                      "compiler.subsetting": "3",
+                                                      "other": "value"})
 
     def package_settings_update_test(self):
         prof = '''[settings]
@@ -63,12 +63,12 @@ MyPackage:os=Windows
 
         np.update_package_settings({"MyPackage": [("OTHER", "2")]})
         self.assertEqual(np.package_settings_values,
-                          {"MyPackage": [("os", "Windows"), ("OTHER", "2")]})
+                         {"MyPackage": [("os", "Windows"), ("OTHER", "2")]})
 
         np.update_package_settings({"MyPackage": [("compiler", "2"), ("compiler.version", "3")]})
         self.assertEqual(np.package_settings_values,
-                          {"MyPackage": [("os", "Windows"), ("OTHER", "2"),
-                                         ("compiler", "2"), ("compiler.version", "3")]})
+                         {"MyPackage": [("os", "Windows"), ("OTHER", "2"),
+                                        ("compiler", "2"), ("compiler.version", "3")]})
 
     def profile_dump_order_test(self):
         # Settings
diff --git a/conans/test/unittests/util/build_sln_command_test.py b/conans/test/unittests/util/build_sln_command_test.py
index cd5364740..aeef5d8a7 100644
--- a/conans/test/unittests/util/build_sln_command_test.py
+++ b/conans/test/unittests/util/build_sln_command_test.py
@@ -3,6 +3,7 @@
 
 import os
 import unittest
+import warnings
 
 from nose.plugins.attrib import attr
 from six import StringIO
@@ -34,42 +35,76 @@ class BuildSLNCommandTest(unittest.TestCase):
         folder = temp_folder()
         path = os.path.join(folder, "dummy.sln")
         save(path, dummy)
-        new_out = StringIO()
-        command = build_sln_command(Settings({}), sln_path=path, targets=None, upgrade_project=False,
-                                    build_type='Debug', arch="x86", parallel=False,
-                                    output=ConanOutput(new_out))
+
+        with warnings.catch_warnings(record=True) as w:
+            warnings.simplefilter("always")
+
+            new_out = StringIO()
+            command = build_sln_command(Settings({}), sln_path=path, targets=None, upgrade_project=False,
+                                        build_type='Debug', arch="x86", parallel=False,
+                                        output=ConanOutput(new_out))
+
+            self.assertEqual(len(w), 1)
+            self.assertTrue(issubclass(w[0].category, DeprecationWarning))
+
         self.assertIn('/p:Configuration="Debug" /p:Platform="x86"', command)
         self.assertIn("WARN: ***** The configuration Debug|x86 does not exist in this solution *****",
                       new_out.getvalue())
 
         # use platforms
-        new_out = StringIO()
-        command = build_sln_command(Settings({}), sln_path=path, targets=None, upgrade_project=False,
-                                    build_type='Debug', arch="x86", parallel=False,
-                                    platforms={"x86": "Win32"}, output=ConanOutput(new_out))
+        with warnings.catch_warnings(record=True) as w:
+            warnings.simplefilter("always")
+
+            new_out = StringIO()
+            command = build_sln_command(Settings({}), sln_path=path, targets=None, upgrade_project=False,
+                                        build_type='Debug', arch="x86", parallel=False,
+                                        platforms={"x86": "Win32"}, output=ConanOutput(new_out))
+
+            self.assertEqual(len(w), 1)
+            self.assertTrue(issubclass(w[0].category, DeprecationWarning))
+
         self.assertIn('/p:Configuration="Debug" /p:Platform="Win32"', command)
         self.assertNotIn("WARN", new_out.getvalue())
         self.assertNotIn("ERROR", new_out.getvalue())
 
     def no_arch_test(self):
         with self.assertRaises(ConanException):
-            new_out = StringIO()
-            build_sln_command(Settings({}), sln_path='dummy.sln', targets=None,
-                              upgrade_project=False, build_type='Debug', arch=None, parallel=False,
-                              output=ConanOutput(new_out))
+            with warnings.catch_warnings(record=True) as w:
+                warnings.simplefilter("always")
+
+                new_out = StringIO()
+                build_sln_command(Settings({}), sln_path='dummy.sln', targets=None,
+                                  upgrade_project=False, build_type='Debug', arch=None, parallel=False,
+                                  output=ConanOutput(new_out))
+
+                self.assertEqual(len(w), 1)
+                self.assertTrue(issubclass(w[0].category, DeprecationWarning))
 
     def no_build_type_test(self):
         with self.assertRaises(ConanException):
-            new_out = StringIO()
-            build_sln_command(Settings({}), sln_path='dummy.sln', targets=None,
-                              upgrade_project=False, build_type=None, arch='x86', parallel=False,
-                              output=ConanOutput(new_out))
+            with warnings.catch_warnings(record=True) as w:
+                warnings.simplefilter("always")
+
+                new_out = StringIO()
+                build_sln_command(Settings({}), sln_path='dummy.sln', targets=None,
+                                  upgrade_project=False, build_type=None, arch='x86', parallel=False,
+                                  output=ConanOutput(new_out))
+
+                self.assertEqual(len(w), 1)
+                self.assertTrue(issubclass(w[0].category, DeprecationWarning))
 
     def positive_test(self):
-        output = ConanOutput(StringIO())
-        command = build_sln_command(Settings({}), sln_path='dummy.sln', targets=None,
-                                    upgrade_project=False, build_type='Debug', arch='x86',
-                                    parallel=False, output=output)
+        with warnings.catch_warnings(record=True) as w:
+            warnings.simplefilter("always")
+
+            output = ConanOutput(StringIO())
+            command = build_sln_command(Settings({}), sln_path='dummy.sln', targets=None,
+                                        upgrade_project=False, build_type='Debug', arch='x86',
+                                        parallel=False, output=output)
+
+            self.assertEqual(len(w), 1)
+            self.assertTrue(issubclass(w[0].category, DeprecationWarning))
+
         self.assertIn('msbuild "dummy.sln"', command)
         self.assertIn('/p:Platform="x86"', command)
         self.assertNotIn('devenv "dummy.sln" /upgrade', command)
@@ -77,10 +112,17 @@ class BuildSLNCommandTest(unittest.TestCase):
         self.assertNotIn('/target:teapot', command)
 
     def upgrade_test(self):
-        output = ConanOutput(StringIO())
-        command = build_sln_command(Settings({}), sln_path='dummy.sln', targets=None,
-                                    upgrade_project=True, build_type='Debug', arch='x86_64',
-                                    parallel=False, output=output)
+        with warnings.catch_warnings(record=True) as w:
+            warnings.simplefilter("always")
+
+            output = ConanOutput(StringIO())
+            command = build_sln_command(Settings({}), sln_path='dummy.sln', targets=None,
+                                        upgrade_project=True, build_type='Debug', arch='x86_64',
+                                        parallel=False, output=output)
+
+            self.assertEqual(len(w), 1)
+            self.assertTrue(issubclass(w[0].category, DeprecationWarning))
+
         self.assertIn('msbuild "dummy.sln"', command)
         self.assertIn('/p:Platform="x64"', command)
         self.assertIn('devenv "dummy.sln" /upgrade', command)
@@ -88,10 +130,17 @@ class BuildSLNCommandTest(unittest.TestCase):
         self.assertNotIn('/target:teapot', command)
 
         with tools.environment_append({"CONAN_SKIP_VS_PROJECTS_UPGRADE": "1"}):
-            output = ConanOutput(StringIO())
-            command = build_sln_command(Settings({}), sln_path='dummy.sln', targets=None,
-                                        upgrade_project=True, build_type='Debug', arch='x86_64',
-                                        parallel=False, output=output)
+            with warnings.catch_warnings(record=True) as w:
+                warnings.simplefilter("always")
+
+                output = ConanOutput(StringIO())
+                command = build_sln_command(Settings({}), sln_path='dummy.sln', targets=None,
+                                            upgrade_project=True, build_type='Debug', arch='x86_64',
+                                            parallel=False, output=output)
+
+                self.assertEqual(len(w), 1)
+                self.assertTrue(issubclass(w[0].category, DeprecationWarning))
+
             self.assertIn('msbuild "dummy.sln"', command)
             self.assertIn('/p:Platform="x64"', command)
             self.assertNotIn('devenv "dummy.sln" /upgrade', command)
@@ -99,17 +148,31 @@ class BuildSLNCommandTest(unittest.TestCase):
             self.assertNotIn('/target:teapot', command)
 
         with tools.environment_append({"CONAN_SKIP_VS_PROJECTS_UPGRADE": "False"}):
+            with warnings.catch_warnings(record=True) as w:
+                warnings.simplefilter("always")
+
+                output = ConanOutput(StringIO())
+                command = build_sln_command(Settings({}), sln_path='dummy.sln', targets=None,
+                                            upgrade_project=True, build_type='Debug', arch='x86_64',
+                                            parallel=False, output=output)
+
+                self.assertEqual(len(w), 1)
+                self.assertTrue(issubclass(w[0].category, DeprecationWarning))
+
+            self.assertIn('devenv "dummy.sln" /upgrade', command)
+
+    def parallel_test(self):
+        with warnings.catch_warnings(record=True) as w:
+            warnings.simplefilter("always")
+
             output = ConanOutput(StringIO())
             command = build_sln_command(Settings({}), sln_path='dummy.sln', targets=None,
-                                        upgrade_project=True, build_type='Debug', arch='x86_64',
+                                        upgrade_project=True, build_type='Debug', arch='armv7',
                                         parallel=False, output=output)
-            self.assertIn('devenv "dummy.sln" /upgrade', command)
 
-    def parallel_test(self):
-        output = ConanOutput(StringIO())
-        command = build_sln_command(Settings({}), sln_path='dummy.sln', targets=None,
-                                    upgrade_project=True, build_type='Debug', arch='armv7',
-                                    parallel=False, output=output)
+            self.assertEqual(len(w), 1)
+            self.assertTrue(issubclass(w[0].category, DeprecationWarning))
+
         self.assertIn('msbuild "dummy.sln"', command)
         self.assertIn('/p:Platform="ARM"', command)
         self.assertIn('devenv "dummy.sln" /upgrade', command)
@@ -117,10 +180,17 @@ class BuildSLNCommandTest(unittest.TestCase):
         self.assertNotIn('/target:teapot', command)
 
     def target_test(self):
-        output = ConanOutput(StringIO())
-        command = build_sln_command(Settings({}), sln_path='dummy.sln', targets=['teapot'],
-                                    upgrade_project=False, build_type='Debug', arch='armv8',
-                                    parallel=False, output=output)
+        with warnings.catch_warnings(record=True) as w:
+            warnings.simplefilter("always")
+
+            output = ConanOutput(StringIO())
+            command = build_sln_command(Settings({}), sln_path='dummy.sln', targets=['teapot'],
+                                        upgrade_project=False, build_type='Debug', arch='armv8',
+                                        parallel=False, output=output)
+
+            self.assertEqual(len(w), 1)
+            self.assertTrue(issubclass(w[0].category, DeprecationWarning))
+
         self.assertIn('msbuild "dummy.sln"', command)
         self.assertIn('/p:Platform="ARM64"', command)
         self.assertNotIn('devenv "dummy.sln" /upgrade', command)
@@ -128,15 +198,22 @@ class BuildSLNCommandTest(unittest.TestCase):
         self.assertIn('/target:teapot', command)
 
     def toolset_test(self):
-        new_out = StringIO()
-        command = build_sln_command(MockSettings({"compiler": "Visual Studio",
-                                                  "compiler.version": "17",
-                                                  "build_type": "Debug",
-                                                  "compiler.runtime": "MDd",
-                                                  "cppstd": "17"}),
-                                    sln_path='dummy.sln', targets=None,
-                                    upgrade_project=False, build_type='Debug', arch='armv7',
-                                    parallel=False, toolset="v110", output=ConanOutput(new_out))
+        with warnings.catch_warnings(record=True) as w:
+            warnings.simplefilter("always")
+
+            new_out = StringIO()
+            command = build_sln_command(MockSettings({"compiler": "Visual Studio",
+                                                      "compiler.version": "17",
+                                                      "build_type": "Debug",
+                                                      "compiler.runtime": "MDd",
+                                                      "cppstd": "17"}),
+                                        sln_path='dummy.sln', targets=None,
+                                        upgrade_project=False, build_type='Debug', arch='armv7',
+                                        parallel=False, toolset="v110", output=ConanOutput(new_out))
+
+            self.assertEqual(len(w), 1)
+            self.assertTrue(issubclass(w[0].category, DeprecationWarning))
+
         self.assertTrue(command.startswith('msbuild "dummy.sln" /p:Configuration="Debug" '
                                            '/p:Platform="ARM" '
                                            '/p:PlatformToolset="v110" '
@@ -144,15 +221,22 @@ class BuildSLNCommandTest(unittest.TestCase):
                                            '/p:ForceImportBeforeCppTargets='), command)
 
     def properties_file_test(self):
-        new_out = StringIO()
-        command = build_sln_command(MockSettings({"compiler": "Visual Studio",
-                                                  "compiler.version": "17",
-                                                  "build_type": "Debug",
-                                                  "compiler.runtime": "MDd",
-                                                  "cppstd": "17"}),
-                                    sln_path='dummy.sln', targets=None,
-                                    upgrade_project=False, build_type='Debug', arch='armv7',
-                                    parallel=False, output=ConanOutput(new_out))
+        with warnings.catch_warnings(record=True) as w:
+            warnings.simplefilter("always")
+
+            new_out = StringIO()
+            command = build_sln_command(MockSettings({"compiler": "Visual Studio",
+                                                      "compiler.version": "17",
+                                                      "build_type": "Debug",
+                                                      "compiler.runtime": "MDd",
+                                                      "cppstd": "17"}),
+                                        sln_path='dummy.sln', targets=None,
+                                        upgrade_project=False, build_type='Debug', arch='armv7',
+                                        parallel=False, output=ConanOutput(new_out))
+
+            self.assertEqual(len(w), 1)
+            self.assertTrue(issubclass(w[0].category, DeprecationWarning))
+
         self.assertTrue(command.startswith('msbuild "dummy.sln" /p:Configuration="Debug" '
                                            '/p:Platform="ARM" '
                                            '/verbosity:minimal '
diff --git a/conans/test/unittests/util/output_test.py b/conans/test/unittests/util/output_test.py
index 26f9a0359..26d6347d9 100644
--- a/conans/test/unittests/util/output_test.py
+++ b/conans/test/unittests/util/output_test.py
@@ -5,7 +5,6 @@ import unittest
 import zipfile
 
 import six
-from six import StringIO
 
 from conans.client import tools
 from conans.client.output import ConanOutput
@@ -18,7 +17,7 @@ from conans.util.files import load, save
 class OutputTest(unittest.TestCase):
 
     def simple_output_test(self):
-        stream = StringIO()
+        stream = six.StringIO()
         output = ConanOutput(stream)
         output.rewrite_line("This is a very long line that has to be truncated somewhere, "
                             "because it is so long it doesn't fit in the output terminal")
@@ -44,7 +43,7 @@ class PkgConan(ConanFile):
         self.assertIn("ENDTEXT", client.user_io.out)
 
     def print_progress_test(self):
-        stream = StringIO()
+        stream = six.StringIO()
         output = ConanOutput(stream)
         for units in range(50):
             print_progress(output, units)
@@ -66,7 +65,7 @@ class PkgConan(ConanFile):
         zipf.close()
 
         output_dir = os.path.join(tmp_dir, "output_dir")
-        new_out = StringIO()
+        new_out = six.StringIO()
         tools.unzip(zip_path, output_dir, output=ConanOutput(new_out))
 
         output = new_out.getvalue()
@@ -89,7 +88,7 @@ class PkgConan(ConanFile):
         zipf.close()
 
         output_dir = os.path.join(tmp_dir, "dst/"*40, "output_dir")
-        new_out = StringIO()
+        new_out = six.StringIO()
         tools.unzip(zip_path, output_dir, output=ConanOutput(new_out))
 
         output = new_out.getvalue()
diff --git a/conans/test/unittests/util/tools_test.py b/conans/test/unittests/util/tools_test.py
index db6c5ac61..b84b82ed3 100644
--- a/conans/test/unittests/util/tools_test.py
+++ b/conans/test/unittests/util/tools_test.py
@@ -6,6 +6,7 @@ import subprocess
 import sys
 import unittest
 import uuid
+import warnings
 from collections import namedtuple
 
 import mock
@@ -397,7 +398,7 @@ class SystemPackageToolTest(unittest.TestCase):
             return
         if platform.system() == "Windows" and not which("choco.exe"):
             return
-        spt = SystemPackageTool()
+        spt = SystemPackageTool(output=self.out)
         expected_package = "git"
         if platform.system() == "Windows" and which("choco.exe"):
             spt = SystemPackageTool(tool=ChocolateyTool(output=self.out), output=self.out)
@@ -486,6 +487,7 @@ class ReplaceInFileTest(unittest.TestCase):
 
 
 class ToolsTest(unittest.TestCase):
+    output = TestBufferConanOutput()
 
     def replace_paths_test(self):
         folder = temp_folder()
@@ -632,7 +634,7 @@ class HelloConan(ConanFile):
 
     def test_global_tools_overrided(self):
         client = TestClient()
- 
+
         conanfile = """
 from conans import ConanFile, tools
 
@@ -683,21 +685,39 @@ class HelloConan(ConanFile):
         settings.os = "Windows"
         settings.compiler = "Visual Studio"
         settings.compiler.version = "14"
+
         # test build_type and arch override, for multi-config packages
-        cmd = tools.msvc_build_command(settings, "project.sln", build_type="Debug", arch="x86")
+        with warnings.catch_warnings(record=True) as w:
+            warnings.simplefilter("always")
+            cmd = tools.msvc_build_command(settings, "project.sln", build_type="Debug",
+                                           arch="x86", output=self.output)
+            self.assertEqual(len(w), 2)
+            self.assertTrue(issubclass(w[0].category, DeprecationWarning))
         self.assertIn('msbuild "project.sln" /p:Configuration="Debug" /p:Platform="x86"', cmd)
         self.assertIn('vcvarsall.bat', cmd)
 
         # tests errors if args not defined
         with six.assertRaisesRegex(self, ConanException, "Cannot build_sln_command"):
-            tools.msvc_build_command(settings, "project.sln")
+            with warnings.catch_warnings(record=True) as w:
+                warnings.simplefilter("always")
+                tools.msvc_build_command(settings, "project.sln", output=self.output)
+                self.assertEqual(len(w), 2)
+                self.assertTrue(issubclass(w[0].category, DeprecationWarning))
         settings.arch = "x86"
         with six.assertRaisesRegex(self, ConanException, "Cannot build_sln_command"):
-            tools.msvc_build_command(settings, "project.sln")
+            with warnings.catch_warnings(record=True) as w:
+                warnings.simplefilter("always")
+                tools.msvc_build_command(settings, "project.sln", output=self.output)
+                self.assertEqual(len(w), 2)
+                self.assertTrue(issubclass(w[0].category, DeprecationWarning))
 
         # successful definition via settings
         settings.build_type = "Debug"
-        cmd = tools.msvc_build_command(settings, "project.sln")
+        with warnings.catch_warnings(record=True) as w:
+            warnings.simplefilter("always")
+            cmd = tools.msvc_build_command(settings, "project.sln", output=self.output)
+            self.assertEqual(len(w), 2)
+            self.assertTrue(issubclass(w[0].category, DeprecationWarning))
         self.assertIn('msbuild "project.sln" /p:Configuration="Debug" /p:Platform="x86"', cmd)
         self.assertIn('vcvarsall.bat', cmd)
 
@@ -773,7 +793,7 @@ class HelloConan(ConanFile):
         settings.os = "Windows"
         settings.compiler = "Visual Studio"
         settings.compiler.version = "14"
-        cmd = tools.vcvars_command(settings)
+        cmd = tools.vcvars_command(settings, output=self.output)
         output = TestBufferConanOutput()
         runner = TestRunner(output)
         runner(cmd + " && set vs140comntools")
@@ -782,7 +802,7 @@ class HelloConan(ConanFile):
         with tools.environment_append({"VisualStudioVersion": "14"}):
             output = TestBufferConanOutput()
             runner = TestRunner(output)
-            cmd = tools.vcvars_command(settings)
+            cmd = tools.vcvars_command(settings, output=self.output)
             runner(cmd + " && set vs140comntools")
             self.assertNotIn("vcvarsall.bat", str(output))
             self.assertIn("Conan:vcvars already set", str(output))
@@ -800,12 +820,12 @@ class HelloConan(ConanFile):
         settings.arch_build = "x86_64"
 
         # Set the env with a PATH containing the vcvars paths
-        tmp = tools.vcvars_dict(settings, only_diff=False)
+        tmp = tools.vcvars_dict(settings, only_diff=False, output=self.output)
         tmp = {key.lower(): value for key, value in tmp.items()}
         with tools.environment_append({"path": tmp["path"]}):
             previous_path = os.environ["PATH"].split(";")
             # Duplicate the path, inside the tools.vcvars shouldn't have repeated entries in PATH
-            with tools.vcvars(settings):
+            with tools.vcvars(settings, output=self.output):
                 path = os.environ["PATH"].split(";")
                 values_count = {value: path.count(value) for value in path}
                 for value, counter in values_count.items():
@@ -822,11 +842,13 @@ class HelloConan(ConanFile):
         settings.arch = "x86"
         settings.arch_build = "x86_64"
         with tools.environment_append({"PATH": ["custom_path", "WindowsFake"]}):
-            tmp = tools.vcvars_dict(settings, only_diff=False, filter_known_paths=True)
+            tmp = tools.vcvars_dict(settings, only_diff=False,
+                                    filter_known_paths=True, output=self.output)
             with tools.environment_append(tmp):
                 self.assertNotIn("custom_path", os.environ["PATH"])
                 self.assertIn("WindowsFake",  os.environ["PATH"])
-            tmp = tools.vcvars_dict(settings, only_diff=False, filter_known_paths=False)
+            tmp = tools.vcvars_dict(settings, only_diff=False,
+                                    filter_known_paths=False, output=self.output)
             with tools.environment_append(tmp):
                 self.assertIn("custom_path", os.environ["PATH"])
                 self.assertIn("WindowsFake", os.environ["PATH"])
@@ -840,12 +862,12 @@ class HelloConan(ConanFile):
         settings.compiler.version = "15"
         settings.arch = "x86"
         settings.arch_build = "x86_64"
-        cmd = tools.vcvars_command(settings)
+        cmd = tools.vcvars_command(settings, output=self.output)
         self.assertIn('vcvarsall.bat" amd64_x86', cmd)
 
         # It follows arch_build first
         settings.arch_build = "x86"
-        cmd = tools.vcvars_command(settings)
+        cmd = tools.vcvars_command(settings, output=self.output)
         self.assertIn('vcvarsall.bat" x86', cmd)
 
     def vcvars_raises_when_not_found_test(self):
@@ -930,22 +952,22 @@ compiler:
         settings.compiler = "Visual Studio"
         settings.compiler.version = "14"
         with tools.environment_append({"MYVAR": "1"}):
-            ret = vcvars_dict(settings, only_diff=False)
+            ret = vcvars_dict(settings, only_diff=False, output=self.output)
             self.assertIn("MYVAR", ret)
             self.assertIn("VCINSTALLDIR", ret)
 
-            ret = vcvars_dict(settings)
+            ret = vcvars_dict(settings, output=self.output)
             self.assertNotIn("MYVAR", ret)
             self.assertIn("VCINSTALLDIR", ret)
 
         my_lib_paths = "C:\\PATH\TO\MYLIBS;C:\\OTHER_LIBPATH"
         with tools.environment_append({"LIBPATH": my_lib_paths}):
-            ret = vcvars_dict(settings, only_diff=False)
+            ret = vcvars_dict(settings, only_diff=False, output=self.output)
             str_var_value = os.pathsep.join(ret["LIBPATH"])
             self.assertTrue(str_var_value.endswith(my_lib_paths))
 
             # Now only a diff, it should return the values as a list, but without the old values
-            ret = vcvars_dict(settings, only_diff=True)
+            ret = vcvars_dict(settings, only_diff=True, output=self.output)
             self.assertEqual(ret["LIBPATH"], str_var_value.split(os.pathsep)[0:-2])
 
             # But if we apply both environments, they are composed correctly
@@ -960,17 +982,17 @@ compiler:
 PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 158 Stepping 9, GenuineIntel
 
 
- PROCESSOR_LEVEL=6 
+ PROCESSOR_LEVEL=6
+
+PROCESSOR_REVISION=9e09
 
-PROCESSOR_REVISION=9e09    
 
-                         
 set nl=^
 env_var=
 without_equals_sign
 
 ProgramFiles(x86)=C:\Program Files (x86)
-       
+
 """.encode("utf-8")
 
         def vcvars_command_mock(settings, arch, compiler_version, force, vcvars_ver, winsdk_version,
@@ -983,7 +1005,7 @@ ProgramFiles(x86)=C:\Program Files (x86)
 
         with mock.patch('conans.client.tools.win.vcvars_command', new=vcvars_command_mock):
             with mock.patch('subprocess.check_output', new=subprocess_check_output_mock):
-                vcvars = tools.vcvars_dict(None, only_diff=False)
+                vcvars = tools.vcvars_dict(None, only_diff=False, output=self.output)
                 self.assertEqual(vcvars["PROCESSOR_ARCHITECTURE"], "AMD64")
                 self.assertEqual(vcvars["PROCESSOR_IDENTIFIER"], "Intel64 Family 6 Model 158 Stepping 9, GenuineIntel")
                 self.assertEqual(vcvars["PROCESSOR_LEVEL"], "6")
@@ -1168,15 +1190,15 @@ ProgramFiles(x86)=C:\Program Files (x86)
         build, host = get_values("Linux", "x86_64", "Linux", "armv8_32")
         self.assertEqual(build, "x86_64-linux-gnu")
         self.assertEqual(host, "aarch64-linux-gnu_ilp32")
-        
+
         build, host = get_values("Linux", "x86_64", "Linux", "armv5el")
         self.assertEqual(build, "x86_64-linux-gnu")
         self.assertEqual(host, "arm-linux-gnueabi")
-        
+
         build, host = get_values("Linux", "x86_64", "Linux", "armv5hf")
         self.assertEqual(build, "x86_64-linux-gnu")
         self.assertEqual(host, "arm-linux-gnueabihf")
-       
+
         build, host = get_values("Linux", "x86_64", "Android", "x86")
         self.assertEqual(build, "x86_64-linux-gnu")
         self.assertEqual(host, "i686-linux-android")
@@ -2268,7 +2290,7 @@ class CollectLibTestCase(unittest.TestCase):
         # Use cpp_info.libdirs
         conanfile.cpp_info.libdirs = ["lib", "custom_folder"]
         result = tools.collect_libs(conanfile)
-        self.assertEqual(["mylib", "customlib"], result)
+        self.assertEqual(["customlib", "mylib"], result)
 
         # Custom folder with multiple libdirs should only collect from custom folder
         self.assertEqual(["lib", "custom_folder"], conanfile.cpp_info.libdirs)
@@ -2334,7 +2356,7 @@ class CollectLibTestCase(unittest.TestCase):
         # Use cpp_info.libdirs
         conanfile.cpp_info.libdirs = ["lib", "custom_folder"]
         result = conanfile.collect_libs()
-        self.assertEqual(["mylib", "customlib"], result)
+        self.assertEqual(["customlib", "mylib"], result)
 
         # Custom folder with multiple libdirs should only collect from custom folder
         self.assertEqual(["lib", "custom_folder"], conanfile.cpp_info.libdirs)
diff --git a/conans/test/unittests/util/vcvars_arch_test.py b/conans/test/unittests/util/vcvars_arch_test.py
index 6e117c276..d1b995c69 100644
--- a/conans/test/unittests/util/vcvars_arch_test.py
+++ b/conans/test/unittests/util/vcvars_arch_test.py
@@ -11,14 +11,17 @@ from conans.client.conf import default_settings_yml
 from conans.client.tools.env import environment_append
 from conans.errors import ConanException
 from conans.model.settings import Settings
+from conans.test.utils.tools import TestBufferConanOutput
 
 
 @attr('visual_studio')
 @unittest.skipUnless(platform.system() == "Windows", "Requires Windows")
 class VCVarsArchTest(unittest.TestCase):
+    output = TestBufferConanOutput()
 
-    def assert_vcvars_command(self, settings, expected, **kwargs):
-        command = tools.vcvars_command(settings, **kwargs)
+    def assert_vcvars_command(self, settings, expected, output=None, **kwargs):
+        output = output or self.output
+        command = tools.vcvars_command(settings, output=output, **kwargs)
         command = command.replace('"', '').replace("'", "")
         self.assertTrue(command.endswith('vcvarsall.bat %s' % expected))
 
@@ -43,7 +46,7 @@ class VCVarsArchTest(unittest.TestCase):
 
         settings.arch = 'mips'
         with self.assertRaises(ConanException):
-            tools.vcvars_command(settings)
+            tools.vcvars_command(settings, output=self.output)
 
         settings.arch_build = 'x86_64'
         settings.arch = 'x86'
@@ -61,7 +64,7 @@ class VCVarsArchTest(unittest.TestCase):
         self.assert_vcvars_command(settings, "amd64_arm64", arch='armv8')
 
         with self.assertRaises(ConanException):
-            tools.vcvars_command(settings, arch='mips')
+            tools.vcvars_command(settings, arch='mips', output=self.output)
 
     def test_vcvars_ver_override(self):
         settings = Settings.loads(default_settings_yml)
@@ -69,13 +72,13 @@ class VCVarsArchTest(unittest.TestCase):
         settings.compiler.version = '15'
         settings.arch = 'x86_64'
 
-        command = tools.vcvars_command(settings, vcvars_ver='14.14')
+        command = tools.vcvars_command(settings, vcvars_ver='14.14', output=self.output)
         self.assertIn('vcvarsall.bat', command)
         self.assertIn('-vcvars_ver=14.14', command)
 
         settings.compiler.version = '14'
 
-        command = tools.vcvars_command(settings, vcvars_ver='14.14')
+        command = tools.vcvars_command(settings, vcvars_ver='14.14', output=self.output)
         self.assertIn('vcvarsall.bat', command)
         self.assertIn('-vcvars_ver=14.14', command)
 
@@ -85,12 +88,12 @@ class VCVarsArchTest(unittest.TestCase):
         settings.compiler.version = '15'
         settings.arch = 'x86_64'
 
-        command = tools.vcvars_command(settings, winsdk_version='8.1')
+        command = tools.vcvars_command(settings, winsdk_version='8.1', output=self.output)
         self.assertIn('vcvarsall.bat', command)
         self.assertIn('8.1', command)
 
         settings.compiler.version = '14'
 
-        command = tools.vcvars_command(settings, winsdk_version='8.1')
+        command = tools.vcvars_command(settings, winsdk_version='8.1', output=self.output)
         self.assertIn('vcvarsall.bat', command)
         self.assertIn('8.1', command)
diff --git a/conans/test/unittests/util/vcvars_clangcl_test.py b/conans/test/unittests/util/vcvars_clangcl_test.py
index 777af661a..5bcba5f6a 100644
--- a/conans/test/unittests/util/vcvars_clangcl_test.py
+++ b/conans/test/unittests/util/vcvars_clangcl_test.py
@@ -12,11 +12,13 @@ from conans.client.conf import default_settings_yml
 from conans.client.tools.win import vcvars_command
 from conans.errors import ConanException
 from conans.model.settings import Settings
+from conans.test.utils.tools import TestBufferConanOutput
 
 
 @attr('visual_studio')
 @unittest.skipUnless(platform.system() == "Windows", "Requires Windows")
 class VCVarsClangClTest(unittest.TestCase):
+    output = TestBufferConanOutput()
 
     def test_simple(self):
         settings = Settings.loads(default_settings_yml)
@@ -25,7 +27,7 @@ class VCVarsClangClTest(unittest.TestCase):
         settings.arch = 'x86'
         settings.os = 'Windows'
 
-        command = vcvars_command(settings)
+        command = vcvars_command(settings, output=self.output)
         self.assertIn('vcvarsall.bat', command)
         self.assertIn('x86', command)
 
@@ -35,7 +37,7 @@ class VCVarsClangClTest(unittest.TestCase):
         settings.arch = 'x86_64'
         settings.os = 'Windows'
 
-        command = vcvars_command(settings)
+        command = vcvars_command(settings, output=self.output)
         self.assertIn('vcvarsall.bat', command)
         self.assertIn('amd64', command)
 
@@ -48,4 +50,4 @@ class VCVarsClangClTest(unittest.TestCase):
         with mock.patch('conans.client.tools.win.latest_vs_version_installed',
                         mock.MagicMock(return_value=None)):
             with self.assertRaises(ConanException):
-                vcvars_command(settings)
+                vcvars_command(settings, output=self.output)
diff --git a/conans/test/unittests/util/vcvars_env_test.py b/conans/test/unittests/util/vcvars_env_test.py
index ca46c808d..f3ae8d301 100644
--- a/conans/test/unittests/util/vcvars_env_test.py
+++ b/conans/test/unittests/util/vcvars_env_test.py
@@ -5,6 +5,8 @@ from conans.test.utils.tools import TestClient
 from conans.util.files import save
 
 
+# TODO: This file does nothing!
+
 class VCVarsTest(unittest.TestCase):
 
     def basic(self):
diff --git a/conans/test/unittests/util/vcvars_store_test.py b/conans/test/unittests/util/vcvars_store_test.py
index 0cf366cba..4767bea90 100644
--- a/conans/test/unittests/util/vcvars_store_test.py
+++ b/conans/test/unittests/util/vcvars_store_test.py
@@ -10,10 +10,13 @@ from conans.client import tools
 from conans.client.conf import default_settings_yml
 from conans.errors import ConanException
 from conans.model.settings import Settings
+from conans.test.utils.tools import TestBufferConanOutput
 
 
 @attr('visual_studio')
 class VCVarsStoreTest(unittest.TestCase):
+    output = TestBufferConanOutput()
+
     def test_81(self):
         if platform.system() != "Windows":
             return
@@ -25,7 +28,7 @@ class VCVarsStoreTest(unittest.TestCase):
         settings.os = 'WindowsStore'
         settings.os.version = '8.1'
 
-        command = tools.vcvars_command(settings)
+        command = tools.vcvars_command(settings, output=self.output)
         self.assertIn('vcvarsall.bat', command)
         self.assertIn('x86', command)
         self.assertIn('store', command)
@@ -45,7 +48,7 @@ class VCVarsStoreTest(unittest.TestCase):
         settings.os = 'WindowsStore'
         settings.os.version = '10.0'
 
-        command = tools.vcvars_command(settings)
+        command = tools.vcvars_command(settings, output=self.output)
         self.assertIn('vcvarsall.bat', command)
         self.assertIn('x86', command)
         self.assertIn('store', command)
@@ -76,4 +79,4 @@ class VCVarsStoreTest(unittest.TestCase):
         settings.os.version = '666'
 
         with self.assertRaises(ConanException):
-            tools.vcvars_command(settings)
+            tools.vcvars_command(settings, output=self.output)
diff --git a/conans/test/unittests/util/xz_test.py b/conans/test/unittests/util/xz_test.py
index af59c5a34..02f9a8142 100644
--- a/conans/test/unittests/util/xz_test.py
+++ b/conans/test/unittests/util/xz_test.py
@@ -13,10 +13,12 @@ from conans.errors import ConanException
 from conans.model.ref import ConanFileReference, PackageReference
 from conans.test.utils.test_files import temp_folder
 from conans.test.utils.tools import NO_SETTINGS_PACKAGE_ID, TestClient, TestServer
+from conans.test.utils.tools import TestBufferConanOutput
 from conans.util.files import load, save_files
 
 
 class XZTest(TestCase):
+    output = TestBufferConanOutput()
 
     def test_error_xz(self):
         server = TestServer()
@@ -96,4 +98,4 @@ class Pkg(ConanFile):
     def test_error_python2(self):
         with six.assertRaisesRegex(self, ConanException, "XZ format not supported in Python 2"):
             dest_folder = temp_folder()
-            unzip("somefile.tar.xz", dest_folder)
+            unzip("somefile.tar.xz", dest_folder, output=self.output)
diff --git a/conans/test/unittests/util/zip_permissions_test.py b/conans/test/unittests/util/zip_permissions_test.py
index f7b0b1210..bbad806cb 100644
--- a/conans/test/unittests/util/zip_permissions_test.py
+++ b/conans/test/unittests/util/zip_permissions_test.py
@@ -36,4 +36,4 @@ class ZipPermissionsTest(TestCase):
                     if keep_permissions:
                         self.assertEqual(stat.S_IMODE(os.stat(dest_file).st_mode), perm_set)
                     else:
-                        self.assertNotEquals(stat.S_IMODE(os.stat(dest_file).st_mode), perm_set)
+                        self.assertNotEqual(stat.S_IMODE(os.stat(dest_file).st_mode), perm_set)