Repository: conan-io/conan

Issue:
[bug] conan download pkg/version@user/channel#randomrev downloads latest
Latest 1.20, Windows 10, python 3.7

With revisions disable this doesn't fail (it should). And worse, it creates an entry with revision ``randomrev`` in the cache.

Also, it seems that it is not possible to ``conan download`` a package with a given package revision.

Discussion:

Patch:
diff --git a/conans/client/cmd/export_pkg.py b/conans/client/cmd/export_pkg.py
index 09a98959c..a4fc16f26 100644
--- a/conans/client/cmd/export_pkg.py
+++ b/conans/client/cmd/export_pkg.py
@@ -4,7 +4,6 @@ from conans.client import packager
 from conans.client.graph.graph_manager import load_deps_info
 from conans.errors import ConanException
 from conans.model.conan_file import get_env_context_manager
-from conans.model.manifest import FileTreeManifest
 from conans.model.ref import PackageReference
 from conans.util.files import rmdir
 
diff --git a/conans/client/cmd/uploader.py b/conans/client/cmd/uploader.py
index 95e08ac6d..90de6309b 100644
--- a/conans/client/cmd/uploader.py
+++ b/conans/client/cmd/uploader.py
@@ -1,7 +1,6 @@
 import os
 import stat
 import tarfile
-import threading
 import time
 from collections import defaultdict
 from multiprocessing.pool import ThreadPool
@@ -97,8 +96,8 @@ class CmdUpload(object):
             self._output.info("Uploading to remote '{}':".format(remote.name))
 
             def upload_ref(ref_conanfile_prefs):
-                ref, conanfile, prefs = ref_conanfile_prefs
-                self._upload_ref(conanfile, ref, prefs, retry, retry_wait,
+                _ref, _conanfile, _prefs = ref_conanfile_prefs
+                self._upload_ref(_conanfile, _ref, _prefs, retry, retry_wait,
                                  integrity_check, policy, remote, upload_recorder, remotes)
 
             self._upload_thread_pool.map(upload_ref,
@@ -190,7 +189,7 @@ class CmdUpload(object):
                         rec_rev = metadata.packages[package_id].recipe_revision
                         if ref.revision != rec_rev:
                             self._output.warn("Skipping package '%s', it doesn't belong to the"
-                                                   " current recipe revision" % package_id)
+                                              " current recipe revision" % package_id)
                             continue
                     package_revision = metadata.packages[package_id].revision
                     assert package_revision is not None, "PREV cannot be None to upload"
@@ -390,8 +389,7 @@ class CmdUpload(object):
                                  % (pref, pref.ref, pref.id))
         tgz_path = os.path.join(package_folder, PACKAGE_TGZ_NAME)
         if is_dirty(tgz_path):
-            self._output.warn("%s: Removing %s, marked as dirty"
-                                   % (str(pref), PACKAGE_TGZ_NAME))
+            self._output.warn("%s: Removing %s, marked as dirty" % (str(pref), PACKAGE_TGZ_NAME))
             os.remove(tgz_path)
             clean_dirty(tgz_path)
         # Get all the files in that directory
@@ -429,7 +427,7 @@ class CmdUpload(object):
                 except NotFoundException:
                     # This is weird, the manifest still not there, better upload everything
                     self._output.warn("The remote recipe doesn't have the 'conanmanifest.txt' "
-                                           "file and will be uploaded: '{}'".format(ref))
+                                      "file and will be uploaded: '{}'".format(ref))
                     return files_to_upload, deleted
 
             if remote_manifest == local_manifest:
@@ -477,7 +475,7 @@ class CmdUpload(object):
             diff = read_manifest.difference(expected_manifest)
             for fname, (h1, h2) in diff.items():
                 self._output.warn("Mismatched checksum '%s' (manifest: %s, file: %s)"
-                                       % (fname, h1, h2))
+                                  % (fname, h1, h2))
 
             if PACKAGE_TGZ_NAME in files:
                 try:
diff --git a/conans/client/command.py b/conans/client/command.py
index 1198096e6..d781fb687 100644
--- a/conans/client/command.py
+++ b/conans/client/command.py
@@ -403,8 +403,12 @@ class Command(object):
         else:
             reference = repr(pref.ref)
             if pref.ref.user is None:
-                reference += "@"
-            packages_list = [pref.id]
+                if pref.ref.revision:
+                    reference = "%s/%s@#%s" % (pref.ref.name, pref.ref.version, pref.ref.revision)
+                else:
+                    reference += "@"
+            pkgref = "{}#{}".format(pref.id, pref.revision) if pref.revision else pref.id
+            packages_list = [pkgref]
             if args.package:
                 raise ConanException("Use a full package reference (preferred) or the `--package`"
                                      " command argument, but not both.")
diff --git a/conans/client/conan_api.py b/conans/client/conan_api.py
index 2d3df0d10..866e73206 100644
--- a/conans/client/conan_api.py
+++ b/conans/client/conan_api.py
@@ -430,6 +430,9 @@ class ConanAPIV1(object):
         # Install packages without settings (fixed ids or all)
         if check_valid_ref(reference):
             ref = ConanFileReference.loads(reference)
+            if ref.revision and not self.app.config.revisions_enabled:
+                raise ConanException("Revisions not enabled in the client, specify a "
+                                     "reference without revision")
             if packages and ref.revision is None:
                 for package_id in packages:
                     if "#" in package_id:
diff --git a/conans/client/conf/__init__.py b/conans/client/conf/__init__.py
index a403ec861..55ceb97eb 100644
--- a/conans/client/conf/__init__.py
+++ b/conans/client/conf/__init__.py
@@ -1,6 +1,5 @@
 import os
 
-from six.moves import urllib
 from six.moves.configparser import ConfigParser, NoSectionError
 
 from conans.errors import ConanException
diff --git a/conans/client/rest/uploader_downloader.py b/conans/client/rest/uploader_downloader.py
index a903d1d2f..19ee7f234 100644
--- a/conans/client/rest/uploader_downloader.py
+++ b/conans/client/rest/uploader_downloader.py
@@ -7,7 +7,7 @@ from conans.util import progress_bar
 from conans.client.rest import response_to_str
 from conans.errors import AuthenticationException, ConanConnectionError, ConanException, \
     NotFoundException, ForbiddenException, RequestErrorException
-from conans.util.files import mkdir, save_append, sha1sum, to_file_bytes
+from conans.util.files import mkdir, sha1sum, to_file_bytes
 from conans.util.log import logger
 from conans.util.tracer import log_download
 
@@ -59,11 +59,11 @@ class FileUploader(object):
         file_name = os.path.basename(abs_path)
         description = "Uploading {}".format(file_name)
 
-        def load_in_chunks(file, size):
+        def load_in_chunks(_file, size):
             """Lazy function (generator) to read a file piece by piece.
             Default chunk size: 1k."""
             while True:
-                chunk = file.read(size)
+                chunk = _file.read(size)
                 if not chunk:
                     break
                 yield chunk
diff --git a/conans/model/settings.py b/conans/model/settings.py
index 2815d9663..6b9075727 100644
--- a/conans/model/settings.py
+++ b/conans/model/settings.py
@@ -233,7 +233,10 @@ class Settings(object):
 
     @staticmethod
     def loads(text):
-        return Settings(yaml.safe_load(text) or {})
+        try:
+            return Settings(yaml.safe_load(text) or {})
+        except (yaml.YAMLError, AttributeError) as ye:
+            raise ConanException("Invalid settings.yml format: {}".format(ye))
 
     def validate(self):
         for field in self.fields:
diff --git a/conans/server/store/disk_adapter.py b/conans/server/store/disk_adapter.py
index 38df83d50..88dd49596 100644
--- a/conans/server/store/disk_adapter.py
+++ b/conans/server/store/disk_adapter.py
@@ -4,7 +4,6 @@ import fasteners
 
 from conans.client.tools.env import no_op
 from conans.errors import NotFoundException
-from conans.server.store.server_store import REVISIONS_FILE
 from conans.util.files import decode_text, md5sum, path_exists, relative_dirs, rmdir
 
 


Test patch:
diff --git a/conans/test/functional/build_helpers/cmake_targets_test.py b/conans/test/functional/build_helpers/cmake_targets_test.py
index 48348fcd1..c46f382d5 100644
--- a/conans/test/functional/build_helpers/cmake_targets_test.py
+++ b/conans/test/functional/build_helpers/cmake_targets_test.py
@@ -5,7 +5,6 @@ import unittest
 from nose.plugins.attrib import attr
 
 from conans.test.utils.tools import TestClient
-from conans.util.files import load
 
 conanfile_py = """
 from conans import ConanFile
diff --git a/conans/test/functional/command/alias_test.py b/conans/test/functional/command/alias_test.py
index 407f5d2e1..fff02c951 100644
--- a/conans/test/functional/command/alias_test.py
+++ b/conans/test/functional/command/alias_test.py
@@ -6,7 +6,6 @@ from parameterized.parameterized import parameterized
 
 from conans.client.tools.files import replace_in_file
 from conans.test.utils.tools import TestClient, TestServer
-from conans.util.files import load
 
 
 class ConanAliasTest(unittest.TestCase):
@@ -158,7 +157,7 @@ class Pkg(ConanFile):
 """
         client.save({"conanfile.py": consumer})
         client.run("info . --graph=file.dot")
-        graphfile = load(os.path.join(client.current_folder, "file.dot"))
+        graphfile = client.load("file.dot")
         self.assertIn('"CB/0.1@user/testing" -> {"CA/0.1@user/testing"}', graphfile)
         self.assertTrue(('"CD/0.1@user/testing" -> {"CA/0.1@user/testing" "CB/0.1@user/testing"}' in graphfile) or
                         ('"CD/0.1@user/testing" -> {"CB/0.1@user/testing" "CA/0.1@user/testing"}' in graphfile))
@@ -211,7 +210,7 @@ class Pkg(ConanFile):
 """
         client.save({"conanfile.py": consumer})
         client.run("info . --graph=file.dot")
-        graphfile = load(os.path.join(client.current_folder, "file.dot"))
+        graphfile = client.load("file.dot")
         self.assertIn('"CM/0.1@user/testing" -> {"CL/0.1@user/testing"}', graphfile)
         self.assertTrue(('"CL/0.1@user/testing" -> {"CK/0.1@user/testing" "CH/0.1@user/testing"}' in graphfile) or
                         ('"CL/0.1@user/testing" -> {"CH/0.1@user/testing" "CK/0.1@user/testing"}' in graphfile))
@@ -255,7 +254,7 @@ class Pkg(ConanFile):
                 {"conanfile.txt": "[requires]\nLibA/latest@user/testing\nLibB/latest@user/testing"},
                 clean_first=True)
         client.run("info conanfile.txt --graph=file.dot")
-        graphfile = load(os.path.join(client.current_folder, "file.dot"))
+        graphfile = client.load("file.dot")
         self.assertIn('"LibA/0.1@user/testing" -> {"LibC/0.1@user/testing"}', graphfile)
         self.assertIn('"LibB/0.1@user/testing" -> {"LibC/0.1@user/testing"}', graphfile)
         self.assertIn('"LibC/0.1@user/testing" -> {"LibD/0.1@user/testing"}', graphfile)
@@ -314,7 +313,7 @@ class Pkg(ConanFile):
         client.save({"conanfile.txt": "[requires]\nLibA/latest@user/testing\nLibB/latest@user/testing"},
                     clean_first=True)
         client.run("info conanfile.txt --graph=file.dot")
-        graphfile = load(os.path.join(client.current_folder, "file.dot"))
+        graphfile = client.load("file.dot")
         self.assertIn('"LibA/0.1@user/testing" -> {"LibC/0.1@user/testing"}', graphfile)
         self.assertIn('"LibB/0.1@user/testing" -> {"LibC/0.1@user/testing"}', graphfile)
         self.assertIn('"LibC/0.1@user/testing" -> {"LibD/0.1@user/testing"}', graphfile)
@@ -363,7 +362,7 @@ class Pkg(ConanFile):
         client.save({"conanfile.txt": "[requires]\nLibA/[~0.1]@user/testing\nLibB/[~0.1]@user/testing"},
                     clean_first=True)
         client.run("info conanfile.txt --graph=file.dot")
-        graphfile = load(os.path.join(client.current_folder, "file.dot"))
+        graphfile = client.load("file.dot")
         self.assertIn('"LibA/sha1@user/testing" -> {"LibC/sha1@user/testing"}', graphfile)
         self.assertIn('"LibB/sha1@user/testing" -> {"LibC/sha1@user/testing"}', graphfile)
         self.assertIn('"LibC/sha1@user/testing" -> {"LibD/sha1@user/testing"}', graphfile)
diff --git a/conans/test/functional/command/create_test.py b/conans/test/functional/command/create_test.py
index cdddd77fe..d6af0afb7 100644
--- a/conans/test/functional/command/create_test.py
+++ b/conans/test/functional/command/create_test.py
@@ -32,7 +32,7 @@ PkgB/0.1@user/testing
 PkgA/0.1@user/testing"""
         client.save({"conanfile.txt": conanfile}, clean_first=True)
         client.run("install . -g txt -g cmake")
-        text = load(os.path.join(client.current_folder, "conanbuildinfo.txt"))
+        text = client.load("conanbuildinfo.txt")
         txt = ";".join(text.splitlines())
         self.assertIn("[libs];LibB;LibA", txt)
         cmake = client.load("conanbuildinfo.cmake")
diff --git a/conans/test/functional/command/download_test.py b/conans/test/functional/command/download_test.py
index d133bf640..423a16bc6 100644
--- a/conans/test/functional/command/download_test.py
+++ b/conans/test/functional/command/download_test.py
@@ -5,6 +5,7 @@ from collections import OrderedDict
 from conans.model.ref import ConanFileReference
 from conans.test.utils.tools import (TestClient, TestServer, NO_SETTINGS_PACKAGE_ID, TurboTestClient,
                                      GenConanfile)
+from conans.util.env_reader import get_env
 from conans.util.files import load
 
 
@@ -220,3 +221,75 @@ class Pkg(ConanFile):
         client.run("download pkg/1.0@")
         self.assertIn("pkg/1.0: Downloading pkg/1.0:%s" % NO_SETTINGS_PACKAGE_ID, client.out)
         self.assertIn("pkg/1.0: Package installed %s" % NO_SETTINGS_PACKAGE_ID, client.out)
+
+    @unittest.skipIf(get_env("TESTING_REVISIONS_ENABLED", False), "No sense with revs")
+    def download_revs_disabled_with_rrev_test(self):
+        # https://github.com/conan-io/conan/issues/6106
+        client = TestClient(revisions_enabled=False)
+        client.run("download pkg/1.0@user/channel#fakerevision", assert_error=True)
+        self.assertIn(
+            "ERROR: Revisions not enabled in the client, specify a reference without revision",
+            client.out)
+
+    @unittest.skipUnless(get_env("TESTING_REVISIONS_ENABLED", False), "Only revisions")
+    def download_revs_enabled_with_fake_rrev_test(self):
+        client = TestClient(default_server_user=True, revisions_enabled=True)
+        client.save({"conanfile.py": GenConanfile()})
+        client.run("create . pkg/1.0@user/channel")
+        client.run("upload * --all --confirm")
+        client.run("remove * -f")
+        client.run("download pkg/1.0@user/channel#fakerevision", assert_error=True)
+        self.assertIn("ERROR: Recipe not found: 'pkg/1.0@user/channel'", client.out)
+
+    @unittest.skipUnless(get_env("TESTING_REVISIONS_ENABLED", False), "Only revisions")
+    def download_revs_enabled_with_rrev_test(self):
+        ref = ConanFileReference.loads("pkg/1.0@user/channel")
+        client = TurboTestClient(default_server_user=True, revisions_enabled=True)
+        pref = client.create(ref, conanfile=GenConanfile())
+        client.run("upload pkg/1.0@user/channel --all --confirm")
+        # create new revision from recipe
+        client.create(ref, conanfile=GenConanfile().with_build_msg("new revision"))
+        client.run("upload pkg/1.0@user/channel --all --confirm")
+        client.run("remove * -f")
+        client.run("download pkg/1.0@user/channel#{}".format(pref.ref.revision))
+        self.assertIn("pkg/1.0@user/channel: Package installed {}".format(pref.id), client.out)
+        search_result = client.search("pkg/1.0@user/channel --revisions")[0]
+        self.assertIn(pref.ref.revision, search_result["revision"])
+
+    @unittest.skipUnless(get_env("TESTING_REVISIONS_ENABLED", False), "Only revisions")
+    def download_revs_enabled_with_rrev_no_user_channel_test(self):
+        ref = ConanFileReference.loads("pkg/1.0@")
+        servers = {"default": TestServer([("*/*@*/*", "*")], [("*/*@*/*", "*")],
+                                         users={"user": "password"})}
+        client = TurboTestClient(servers=servers, revisions_enabled=True,
+                                 users={"default": [("user", "password")]})
+        pref = client.create(ref, conanfile=GenConanfile())
+        client.run("upload pkg/1.0@ --all --confirm")
+        # create new revision from recipe
+        client.create(ref, conanfile=GenConanfile().with_build_msg("new revision"))
+        client.run("upload pkg/1.0@ --all --confirm")
+        client.run("remove * -f")
+        client.run("download pkg/1.0@#{}".format(pref.ref.revision))
+        self.assertIn("pkg/1.0: Package installed {}".format(pref.id), client.out)
+        search_result = client.search("pkg/1.0@ --revisions")[0]
+        self.assertIn(pref.ref.revision, search_result["revision"])
+
+    @unittest.skipUnless(get_env("TESTING_REVISIONS_ENABLED", False), "Only revisions")
+    def download_revs_enabled_with_prev_test(self):
+        # https://github.com/conan-io/conan/issues/6106
+        ref = ConanFileReference.loads("pkg/1.0@user/channel")
+        client = TurboTestClient(default_server_user=True, revisions_enabled=True)
+        pref = client.create(ref, conanfile=GenConanfile())
+        client.run("upload pkg/1.0@user/channel --all --confirm")
+        client.create(ref, conanfile=GenConanfile().with_build_msg("new revision"))
+        client.run("upload pkg/1.0@user/channel --all --confirm")
+        client.run("remove * -f")
+        client.run("download pkg/1.0@user/channel#{}:{}#{}".format(pref.ref.revision,
+                                                                   pref.id,
+                                                                   pref.revision))
+        self.assertIn("pkg/1.0@user/channel: Package installed {}".format(pref.id), client.out)
+        search_result = client.search("pkg/1.0@user/channel --revisions")[0]
+        self.assertIn(pref.ref.revision, search_result["revision"])
+        search_result = client.search(
+            "pkg/1.0@user/channel#{}:{} --revisions".format(pref.ref.revision, pref.id))[0]
+        self.assertIn(pref.revision, search_result["revision"])
diff --git a/conans/test/functional/command/info_test.py b/conans/test/functional/command/info_test.py
index 435c8d021..1c6eb29b5 100644
--- a/conans/test/functional/command/info_test.py
+++ b/conans/test/functional/command/info_test.py
@@ -217,7 +217,7 @@ class MyTest(ConanFile):
         save(viscss_path, "")
         client.save({"conanfile.txt": ""})
         client.run("info . --graph=file.html")
-        html = load(os.path.join(client.current_folder, "file.html"))
+        html = client.load("file.html")
         self.assertIn("<body>", html)
         self.assertNotIn("cloudflare", html)
         self.assertIn(visjs_path, html)
@@ -437,7 +437,7 @@ class MyTest(ConanFile):
         self.client.run("info Hello1/0.1@lasote/stable -bo=Hello0/0.1@lasote/stable "
                         "--json=file.json")
         self.assertEqual('{"groups": [["Hello0/0.1@lasote/stable"], ["Hello1/0.1@lasote/stable"]]}',
-                         load(os.path.join(self.client.current_folder, "file.json")))
+                         self.client.load("file.json"))
 
         self.client.run("info Hello1/0.1@lasote/stable -bo=Hello0/0.1@lasote/stable --json")
         self.assertIn('{"groups": [["Hello0/0.1@lasote/stable"], ["Hello1/0.1@lasote/stable"]]}',
diff --git a/conans/test/functional/command/inspect_test.py b/conans/test/functional/command/inspect_test.py
index 97cfc33ad..731bb13a5 100644
--- a/conans/test/functional/command/inspect_test.py
+++ b/conans/test/functional/command/inspect_test.py
@@ -4,7 +4,6 @@ import textwrap
 import unittest
 
 from conans.test.utils.tools import TestClient, TestServer
-from conans.util.files import load
 
 
 class ConanInspectTest(unittest.TestCase):
@@ -70,7 +69,7 @@ class Pkg(ConanFile):
         self.assertIn("name: MyPkg", client.out)
         self.assertIn("version: 1.2.3", client.out)
         client.run("inspect . -a=version -a=name --json=file.json")
-        contents = load(os.path.join(client.current_folder, "file.json"))
+        contents = client.load("file.json")
         self.assertIn('"version": "1.2.3"', contents)
         self.assertIn('"name": "MyPkg"', contents)
 
@@ -131,7 +130,7 @@ default_options:
 """)
 
         client.run("inspect . -a=version -a=name -a=options -a=default_options --json=file.json")
-        contents = load(os.path.join(client.current_folder, "file.json"))
+        contents = client.load("file.json")
         json_contents = json.loads(contents)
         self.assertEqual(json_contents["version"], None)
         self.assertEqual(json_contents["name"], None)
diff --git a/conans/test/functional/command/install_test.py b/conans/test/functional/command/install_test.py
index 0a78b2517..0cc01c220 100644
--- a/conans/test/functional/command/install_test.py
+++ b/conans/test/functional/command/install_test.py
@@ -11,7 +11,7 @@ from conans.paths import CONANFILE, CONANFILE_TXT, CONANINFO
 from conans.test.utils.cpp_test_files import cpp_hello_conan_files
 from conans.test.utils.tools import NO_SETTINGS_PACKAGE_ID
 from conans.test.utils.tools import TestClient, TestServer, GenConanfile
-from conans.util.files import load, mkdir, rmdir
+from conans.util.files import mkdir, rmdir
 
 
 class InstallTest(unittest.TestCase):
@@ -463,10 +463,10 @@ class TestConan(ConanFile):
                       client.out)  # Test "from local cache" output message
         client.run("install . --build=missing -s os=Macos -s os_build=Macos "
                    "--install-folder=os_dir")
-        conaninfo = load(os.path.join(client.current_folder, "win_dir/conaninfo.txt"))
+        conaninfo = client.load("win_dir/conaninfo.txt")
         self.assertIn("os=Windows", conaninfo)
         self.assertNotIn("os=Macos", conaninfo)
-        conaninfo = load(os.path.join(client.current_folder, "os_dir/conaninfo.txt"))
+        conaninfo = client.load("os_dir/conaninfo.txt")
         self.assertNotIn("os=Windows", conaninfo)
         self.assertIn("os=Macos", conaninfo)
 
diff --git a/conans/test/functional/command/json_output_test.py b/conans/test/functional/command/json_output_test.py
index ef6c72d5c..fc7b276d8 100644
--- a/conans/test/functional/command/json_output_test.py
+++ b/conans/test/functional/command/json_output_test.py
@@ -21,7 +21,7 @@ class JsonOutputTest(unittest.TestCase):
         files = cpp_hello_conan_files("CC", "1.0", build=False)
         self.client.save(files, clean_first=True)
         self.client.run("create . private_user/channel --json=myfile.json")
-        my_json = json.loads(load(os.path.join(self.client.current_folder, "myfile.json")))
+        my_json = json.loads(self.client.load("myfile.json"))
         self.assertFalse(my_json["error"])
         tmp = ConanFileReference.loads(my_json["installed"][0]["recipe"]["id"])
         self.assertEqual(str(tmp), "CC/1.0@private_user/channel")
@@ -38,7 +38,7 @@ class JsonOutputTest(unittest.TestCase):
         self.client.run("upload CC/1.0@private_user/channel -c")
         self.client.run("remove '*' -f")
         self.client.run("install CC/1.0@private_user/channel --json=myfile.json --build missing ")
-        my_json = json.loads(load(os.path.join(self.client.current_folder, "myfile.json")))
+        my_json = json.loads(self.client.load("myfile.json"))
 
         the_time_str = my_json["installed"][0]["recipe"]["time"]
         self.assertIn("T", the_time_str)  # Weak validation of the ISO 8601
@@ -54,7 +54,7 @@ class JsonOutputTest(unittest.TestCase):
         self.client.run("upload CC/1.0@private_user/channel --all -c")
         self.client.run("remove '*' -f")
         self.client.run("install CC/1.0@private_user/channel --json=myfile.json")
-        my_json = json.loads(load(os.path.join(self.client.current_folder, "myfile.json")))
+        my_json = json.loads(self.client.load("myfile.json"))
 
         self.assertFalse(my_json["error"])
         self.assertEqual(my_json["installed"][0]["recipe"]["id"], "CC/1.0@private_user/channel")
@@ -67,7 +67,7 @@ class JsonOutputTest(unittest.TestCase):
         # Force build
         self.client.run("remove '*' -f")
         self.client.run("install CC/1.0@private_user/channel --json=myfile.json --build")
-        my_json = json.loads(load(os.path.join(self.client.current_folder, "myfile.json")))
+        my_json = json.loads(self.client.load("myfile.json"))
 
         self.assertFalse(my_json["error"])
         self.assertEqual(my_json["installed"][0]["recipe"]["id"], "CC/1.0@private_user/channel")
@@ -81,7 +81,7 @@ class JsonOutputTest(unittest.TestCase):
 
         # Missing recipe
         self.client.run("install CC/1.0@private_user/channel --json=myfile.json", assert_error=True)
-        my_json = json.loads(load(os.path.join(self.client.current_folder, "myfile.json")))
+        my_json = json.loads(self.client.load("myfile.json"))
         self.assertTrue(my_json["error"])
         self.assertEqual(len(my_json["installed"]), 1)
         self.assertFalse(my_json["installed"][0]["recipe"]["downloaded"])
@@ -96,7 +96,7 @@ class JsonOutputTest(unittest.TestCase):
         self.client.run("upload CC/1.0@private_user/channel -c")
         self.client.run("remove '*' -f")
         self.client.run("install CC/1.0@private_user/channel --json=myfile.json", assert_error=True)
-        my_json = json.loads(load(os.path.join(self.client.current_folder, "myfile.json")))
+        my_json = json.loads(self.client.load("myfile.json"))
 
         self.assertTrue(my_json["error"])
         self.assertEqual(len(my_json["installed"]), 1)
@@ -118,7 +118,7 @@ class JsonOutputTest(unittest.TestCase):
 
         self.client.save(files, clean_first=True)
         self.client.run("create . private_user/channel --json=myfile.json ", assert_error=True)
-        my_json = json.loads(load(os.path.join(self.client.current_folder, "myfile.json")))
+        my_json = json.loads(self.client.load("myfile.json"))
         self.assertTrue(my_json["error"])
         self.assertEqual(my_json["installed"][0]["packages"][0]["error"]["type"], "building")
         self.assertIsNone(my_json["installed"][0]["packages"][0]["error"]["remote"])
@@ -162,7 +162,7 @@ AA*: CC/1.0@private_user/channel
                                       deps=["AA/1.0@private_user/channel"], build=False)
         self.client.save(files, clean_first=True)
         self.client.run("install . --profile mybr --json=myfile.json --build AA --build BB")
-        my_json = load(os.path.join(self.client.current_folder, "myfile.json"))
+        my_json = self.client.load("myfile.json")
         my_json = json.loads(my_json)
 
         self.assertTrue(my_json["installed"][0]["recipe"]["dependency"])
@@ -193,7 +193,7 @@ AA*: CC/1.0@private_user/channel
             """)
         self.client.save({'conanfile.py': conanfile})
         self.client.run("create . name/version@user/channel --json=myfile.json")
-        my_json = load(os.path.join(self.client.current_folder, "myfile.json"))
+        my_json = self.client.load("myfile.json")
         my_json = json.loads(my_json)
 
         # Nodes with cpp_info
diff --git a/conans/test/functional/command/new_test.py b/conans/test/functional/command/new_test.py
index aa24be7a9..b4b5b3da7 100644
--- a/conans/test/functional/command/new_test.py
+++ b/conans/test/functional/command/new_test.py
@@ -19,7 +19,7 @@ class NewTest(unittest.TestCase):
         """)
         save(os.path.join(client.cache_folder, "templates/mytemplate.py"), template1)
         client.run("new hello/0.1 --template=mytemplate.py")
-        conanfile = load(os.path.join(client.current_folder, "conanfile.py"))
+        conanfile = client.load("conanfile.py")
         self.assertIn("class HelloConan(ConanFile):", conanfile)
         self.assertIn('name = "hello"', conanfile)
         self.assertIn('version = "0.1"', conanfile)
@@ -33,7 +33,7 @@ class NewTest(unittest.TestCase):
         save(os.path.join(client.cache_folder, "templates", "subfolder", "mytemplate.py"),
              template2)
         client.run("new hello/0.1 -m=subfolder/mytemplate.py")
-        conanfile = load(os.path.join(client.current_folder, "conanfile.py"))
+        conanfile = client.load("conanfile.py")
         self.assertIn("class HelloConan(ConanFile):", conanfile)
         self.assertIn('version = "fixed"', conanfile)
 
@@ -47,7 +47,7 @@ class NewTest(unittest.TestCase):
         full_path = os.path.join(tmp, "templates", "subfolder", "mytemplate.py")
         save(full_path, template2)
         client.run('new hello/0.1 --template="%s"' % full_path)
-        conanfile = load(os.path.join(client.current_folder, "conanfile.py"))
+        conanfile = client.load("conanfile.py")
         self.assertIn("class HelloConan(ConanFile):", conanfile)
         self.assertIn('version = "fixed"', conanfile)
 
diff --git a/conans/test/functional/command/remove_test.py b/conans/test/functional/command/remove_test.py
index 54772ecfd..7999da879 100644
--- a/conans/test/functional/command/remove_test.py
+++ b/conans/test/functional/command/remove_test.py
@@ -1,6 +1,5 @@
 import os
 import platform
-import textwrap
 import unittest
 
 import six
diff --git a/conans/test/functional/command/search_test.py b/conans/test/functional/command/search_test.py
index 866d9ec7f..907b8698c 100644
--- a/conans/test/functional/command/search_test.py
+++ b/conans/test/functional/command/search_test.py
@@ -382,7 +382,7 @@ helloTest/1.4.10@myuser/stable""".format(remote)
 
     def search_html_table_test(self):
         self.client.run("search Hello/1.4.10@myuser/testing --table=table.html")
-        html = load(os.path.join(self.client.current_folder, "table.html"))
+        html = self.client.load("table.html")
         self.assertIn("<h1>Hello/1.4.10@myuser/testing</h1>", html)
         self.assertIn("<td>Linux gcc 4.5 (libstdc++11)</td>", html)
         self.assertIn("<td>Windows Visual Studio 8.1</td>", html)
@@ -394,7 +394,7 @@ helloTest/1.4.10@myuser/stable""".format(remote)
         self._copy_to_server(self.client.cache, self.servers["search_able"].server_store)
 
         self.client.run("search Hello/1.4.10@myuser/testing -r=all --table=table.html")
-        html = load(os.path.join(self.client.current_folder, "table.html"))
+        html = self.client.load("table.html")
 
         self.assertIn("<h1>Hello/1.4.10@myuser/testing</h1>", html)
         self.assertIn("<h2>'local':</h2>", html)
diff --git a/conans/test/functional/command/source_test.py b/conans/test/functional/command/source_test.py
index 1e978c6fa..bb57e2d3f 100644
--- a/conans/test/functional/command/source_test.py
+++ b/conans/test/functional/command/source_test.py
@@ -5,7 +5,7 @@ import six
 
 from conans.paths import BUILD_INFO, CONANFILE
 from conans.test.utils.tools import TestClient
-from conans.util.files import load, mkdir
+from conans.util.files import mkdir
 
 
 class SourceTest(unittest.TestCase):
@@ -278,4 +278,4 @@ class ConanLib(ConanFile):
         client.run("source .")
         self.assertIn("conanfile.py: Configuring sources in", client.out)
         self.assertIn("conanfile.py: Running source!", client.out)
-        self.assertEqual("Hello World", load(os.path.join(client.current_folder, "file1.txt")))
+        self.assertEqual("Hello World", client.load("file1.txt"))
diff --git a/conans/test/functional/configuration/invalid_settings_test.py b/conans/test/functional/configuration/invalid_settings_test.py
new file mode 100644
index 000000000..8dd30e2f6
--- /dev/null
+++ b/conans/test/functional/configuration/invalid_settings_test.py
@@ -0,0 +1,28 @@
+import os
+import textwrap
+import unittest
+
+from conans.test.utils.tools import TestClient
+
+
+class SettingsLoadTestCase(unittest.TestCase):
+    def test_invalid_settings(self):
+        client = TestClient()
+        client.save({os.path.join(client.cache_folder, 'settings.yml'): """your buggy file"""})
+        client.run("new -b hello/1.0")
+        client.run("install .", assert_error=True)
+        self.assertIn("ERROR: Invalid settings.yml format", client.out)
+
+    def test_invalid_yaml(self):
+        client = TestClient()
+        client.save({os.path.join(client.cache_folder, 'settings.yml'):
+                     textwrap.dedent("""
+                        Almost:
+                            - a
+                            - valid
+                          yaml
+                     """)})
+        client.run("new -b hello/1.0")
+        client.run("install .", assert_error=True)
+        self.assertIn("ERROR: Invalid settings.yml format: while parsing a block mapping",
+                      client.out)
diff --git a/conans/test/functional/configuration/profile_test.py b/conans/test/functional/configuration/profile_test.py
index 8bdc5d5ae..6c43ce23d 100644
--- a/conans/test/functional/configuration/profile_test.py
+++ b/conans/test/functional/configuration/profile_test.py
@@ -53,11 +53,11 @@ class ProfileTest(unittest.TestCase):
                        env=[("A_VAR", "A_VALUE"), ("PREPEND_VAR", ["new_path", "other_path"])],
                        package_env={"Hello0": [("OTHER_VAR", "2")]})
         self.client.run("install . -pr envs -g virtualenv")
-        content = load(os.path.join(self.client.current_folder, "activate.sh"))
+        content = self.client.load("activate.sh")
         self.assertIn(":".join(["PREPEND_VAR=\"new_path\"", "\"other_path\""]) +
                       "${PREPEND_VAR+:$PREPEND_VAR}", content)
         if platform.system() == "Windows":
-            content = load(os.path.join(self.client.current_folder, "activate.bat"))
+            content = self.client.load("activate.bat")
             self.assertIn(";".join(["PREPEND_VAR=new_path", "other_path", "%PREPEND_VAR%"]),
                           content)
 
@@ -213,13 +213,13 @@ class ProfileTest(unittest.TestCase):
         self.client.save(files)
         self.client.run("export . lasote/stable")
         self.client.run("install . --build missing -pr vs_12_86")
-        info = load(os.path.join(self.client.current_folder, "conaninfo.txt"))
+        info = self.client.load("conaninfo.txt")
         for setting, value in profile_settings.items():
             self.assertIn("%s=%s" % (setting, value), info)
 
         # Try to override some settings in install command
         self.client.run("install . --build missing -pr vs_12_86 -s compiler.version=14")
-        info = load(os.path.join(self.client.current_folder, "conaninfo.txt"))
+        info = self.client.load("conaninfo.txt")
         for setting, value in profile_settings.items():
             if setting != "compiler.version":
                 self.assertIn("%s=%s" % (setting, value), info)
@@ -237,7 +237,7 @@ class ProfileTest(unittest.TestCase):
                        package_settings=package_settings)
         # Try to override some settings in install command
         self.client.run("install . --build missing -pr vs_12_86_Hello0_gcc -s compiler.version=14")
-        info = load(os.path.join(self.client.current_folder, "conaninfo.txt"))
+        info = self.client.load("conaninfo.txt")
         self.assertIn("compiler=gcc", info)
         self.assertIn("compiler.libcxx=libstdc++11", info)
 
@@ -248,7 +248,7 @@ class ProfileTest(unittest.TestCase):
                        package_settings=package_settings)
         # Try to override some settings in install command
         self.client.run("install . --build missing -pr vs_12_86_Hello0_gcc -s compiler.version=14")
-        info = load(os.path.join(self.client.current_folder, "conaninfo.txt"))
+        info = self.client.load("conaninfo.txt")
         self.assertIn("compiler=Visual Studio", info)
         self.assertNotIn("compiler.libcxx", info)
 
@@ -260,7 +260,7 @@ class ProfileTest(unittest.TestCase):
         # Try to override some settings in install command
         self.client.run("install . --build missing -pr vs_12_86_Hello0_gcc"
                         " -s compiler.version=14 -s Hello0:compiler.libcxx=libstdc++")
-        info = load(os.path.join(self.client.current_folder, "conaninfo.txt"))
+        info = self.client.load("conaninfo.txt")
         self.assertIn("compiler=gcc", info)
         self.assertNotIn("compiler.libcxx=libstdc++11", info)
         self.assertIn("compiler.libcxx=libstdc++", info)
@@ -287,7 +287,7 @@ class ProfileTest(unittest.TestCase):
                         package_settings=package_settings)
         # Try to override some settings in install command
         self.client.run("install . lasote/testing -pr myprofile")
-        info = load(os.path.join(self.client.current_folder, "conaninfo.txt"))
+        info = self.client.load("conaninfo.txt")
         self.assertIn("compiler=gcc", info)
         self.assertIn("compiler.libcxx=libstdc++11", info)
         self.assertIn("compiler.version=4.8", info)
@@ -298,7 +298,7 @@ class ProfileTest(unittest.TestCase):
                         package_settings=package_settings)
         # Try to override some settings in install command
         self.client.run("install . lasote/testing -pr myprofile")
-        info = load(os.path.join(self.client.current_folder, "conaninfo.txt"))
+        info = self.client.load("conaninfo.txt")
         self.assertIn("compiler=Visual Studio", info)
         self.assertIn("compiler.runtime=MD", info)
         self.assertIn("compiler.version=12", info)
@@ -314,7 +314,7 @@ class ProfileTest(unittest.TestCase):
 
         self.client.save(files)
         self.client.run("install . --build missing -pr vs_12_86")
-        info = load(os.path.join(self.client.current_folder, "conaninfo.txt"))
+        info = self.client.load("conaninfo.txt")
         self.assertIn("language=1", info)
         self.assertIn("static=False", info)
 
diff --git a/conans/test/functional/environment/apply_environment_test.py b/conans/test/functional/environment/apply_environment_test.py
index 6e8b6420d..2aae83cf5 100644
--- a/conans/test/functional/environment/apply_environment_test.py
+++ b/conans/test/functional/environment/apply_environment_test.py
@@ -283,7 +283,7 @@ virtualrunenv
         ext = "bat" if platform.system() == "Windows" else "sh"
         self.assertTrue(os.path.exists(os.path.join(client.current_folder, "activate_run.%s" % ext)))
         self.assertTrue(os.path.exists(os.path.join(client.current_folder, "deactivate_run.%s" % ext)))
-        activate_contents = load(os.path.join(client.current_folder, "activate_run.%s" % ext))
+        activate_contents = client.load("activate_run.%s" % ext)
 
         self.assertIn("PATH", activate_contents)
         self.assertIn("LD_LIBRARY_PATH", activate_contents)
@@ -427,8 +427,8 @@ class HelloConan(ConanFile):
         ext = "bat" if platform.system() == "Windows" else "sh"
         self.assertTrue(os.path.exists(os.path.join(client.current_folder, "activate.%s" % ext)))
         self.assertTrue(os.path.exists(os.path.join(client.current_folder, "deactivate.%s" % ext)))
-        activate_contents = load(os.path.join(client.current_folder, "activate.%s" % ext))
-        deactivate_contents = load(os.path.join(client.current_folder, "deactivate.%s" % ext))
+        activate_contents = client.load("activate.%s" % ext)
+        deactivate_contents = client.load("deactivate.%s" % ext)
         self.assertNotIn("bad value", activate_contents)
         if platform.system() == "Windows":
             self.assertIn("var1=good value", activate_contents)
@@ -665,7 +665,7 @@ virtualenv
 """
         client.save({"conanfile.txt": conanfile}, clean_first=True)
         client.run("install .")
-        info = load(os.path.join(client.current_folder, "conanbuildinfo.txt"))
+        info = client.load("conanbuildinfo.txt")
         info = info.replace("\r\n", "\n")
         self.assertIn("""
 [ENV_libA]
@@ -673,10 +673,10 @@ PATH=["path_from_A"]
 [ENV_libB]
 PATH=["path_from_B"]""", info)
         if platform.system() != "Windows":
-            activate = load(os.path.join(client.current_folder, "activate.sh"))
+            activate = client.load("activate.sh")
             self.assertIn('PATH="path_from_A":"path_from_B"${PATH+:$PATH}', activate)
         else:
-            activate = load(os.path.join(client.current_folder, "activate.bat"))
+            activate = client.load("activate.bat")
             self.assertIn('PATH=path_from_A;path_from_B;%PATH%', activate)
 
     def check_conaninfo_completion_test(self):
diff --git a/conans/test/functional/generators/cmake_multi_test.py b/conans/test/functional/generators/cmake_multi_test.py
index 96ea70bf9..44960b64a 100644
--- a/conans/test/functional/generators/cmake_multi_test.py
+++ b/conans/test/functional/generators/cmake_multi_test.py
@@ -344,7 +344,7 @@ class CMakeMultiSyntaxTest(unittest.TestCase):
         """
         Check conan_basic_setup() interface is the same one for cmake and cmake_multi generators
         """
-        conanbuildinfo = load(os.path.join(self.client.current_folder, "conanbuildinfo.cmake"))
+        conanbuildinfo = self.client.load("conanbuildinfo.cmake")
         conanbuildinfo_multi = load(os.path.join(self.client.current_folder,
                                                  "conanbuildinfo_multi.cmake"))
         expected = "set(options TARGETS NO_OUTPUT_DIRS SKIP_RPATH KEEP_RPATHS SKIP_STD SKIP_FPIC)"
diff --git a/conans/test/functional/generators/cmake_paths_test.py b/conans/test/functional/generators/cmake_paths_test.py
index fb4ae6e5d..90eb923c0 100644
--- a/conans/test/functional/generators/cmake_paths_test.py
+++ b/conans/test/functional/generators/cmake_paths_test.py
@@ -5,7 +5,6 @@ import unittest
 
 from conans.model.ref import ConanFileReference, PackageReference
 from conans.test.utils.tools import TestClient, NO_SETTINGS_PACKAGE_ID, TurboTestClient, GenConanfile
-from conans.util.files import load
 
 
 class CMakePathsGeneratorTest(unittest.TestCase):
@@ -19,7 +18,7 @@ class CMakePathsGeneratorTest(unittest.TestCase):
         client.run("install {} -g cmake_paths".format(ref2))
         pfolder1 = client.cache.package_layout(pref1.ref).package(pref1).replace("\\", "/")
         pfolder2 = client.cache.package_layout(pref2.ref).package(pref2).replace("\\", "/")
-        contents = load(os.path.join(client.current_folder, "conan_paths.cmake"))
+        contents = client.load("conan_paths.cmake")
         expected = 'set(CONAN_LIB2_ROOT "{pfolder2}")\r\n' \
                    'set(CONAN_LIB1_ROOT "{pfolder1}")\r\n' \
                    'set(CMAKE_MODULE_PATH "{pfolder2}/"\r\n\t\t\t"{pfolder1}/" ' \
diff --git a/conans/test/functional/generators/cmake_test.py b/conans/test/functional/generators/cmake_test.py
index da1c6b9b2..75a8704c2 100644
--- a/conans/test/functional/generators/cmake_test.py
+++ b/conans/test/functional/generators/cmake_test.py
@@ -5,7 +5,6 @@ import unittest
 
 from nose.plugins.attrib import attr
 
-from conans import load
 from conans.client.tools import replace_in_file
 from conans.model.ref import ConanFileReference
 from conans.test.utils.tools import TestClient, GenConanfile, TurboTestClient
diff --git a/conans/test/functional/generators/custom_generator_test.py b/conans/test/functional/generators/custom_generator_test.py
index 0293cf73b..b9b0da0f6 100644
--- a/conans/test/functional/generators/custom_generator_test.py
+++ b/conans/test/functional/generators/custom_generator_test.py
@@ -1,4 +1,3 @@
-import os
 import textwrap
 import unittest
 
@@ -6,7 +5,6 @@ from conans.model.ref import ConanFileReference
 from conans.paths import CONANFILE, CONANFILE_TXT
 from conans.test.utils.cpp_test_files import cpp_hello_conan_files
 from conans.test.utils.tools import TestClient, TestServer
-from conans.util.files import load
 
 generator = """
 from conans.model import Generator
@@ -93,7 +91,7 @@ class CustomGeneratorTest(unittest.TestCase):
         files = {CONANFILE_TXT: consumer}
         client.save(files, clean_first=True)
         client.run("install . --build")
-        generated = load(os.path.join(client.current_folder, "customfile.gen"))
+        generated = client.load("customfile.gen")
         self.assertEqual(generated, "My custom generator content")
 
         # Test retrieval from remote
@@ -102,7 +100,7 @@ class CustomGeneratorTest(unittest.TestCase):
         client.save(files)
         client.run("install . --build")
 
-        generated = load(os.path.join(client.current_folder, "customfile.gen"))
+        generated = client.load("customfile.gen")
         self.assertEqual(generated, "My custom generator content")
 
     def multifile_test(self):
@@ -121,7 +119,7 @@ class CustomGeneratorTest(unittest.TestCase):
                       "Property 'filename' not used",
                       client.out)
         for i in (1, 2):
-            generated = load(os.path.join(client.current_folder, "file%d.gen" % i))
+            generated = client.load("file%d.gen" % i)
             self.assertEqual(generated, "CustomContent%d" % i)
 
     def export_template_generator_test(self):
@@ -146,7 +144,7 @@ class MyCustomGeneratorWithTemplatePackage(ConanFile):
         client.run("create . gen/0.1@user/stable")
 
         client.run("install gen/0.1@user/stable -g=MyCustomTemplateGenerator")
-        generated = load(os.path.join(client.current_folder, "customfile.gen"))
+        generated = client.load("customfile.gen")
         self.assertEqual(generated, "Template: Hello")
 
     def install_folder_test(self):
@@ -169,6 +167,6 @@ class MyCustomGeneratorWithTemplatePackage(ConanFile):
         client.save({CONANFILE: templated_generator, "mytemplate.txt": "Template: %s"})
         client.run("create . gen/0.1@user/stable")
         client.run("install gen/0.1@user/stable -g=MyGenerator")
-        generated = load(os.path.join(client.current_folder, "customfile.gen"))
+        generated = client.load("customfile.gen")
         self.assertEqual(generated, client.current_folder)
 
diff --git a/conans/test/functional/generators/generators_test.py b/conans/test/functional/generators/generators_test.py
index e278d073a..649558059 100644
--- a/conans/test/functional/generators/generators_test.py
+++ b/conans/test/functional/generators/generators_test.py
@@ -5,7 +5,6 @@ import unittest
 
 from conans.model.graph_info import GRAPH_INFO_FILE
 from conans.test.utils.tools import NO_SETTINGS_PACKAGE_ID, TestClient
-from conans.util.files import load
 from conans.model.graph_lock import LOCKFILE
 
 
@@ -102,7 +101,7 @@ qmake
         client.save({"conanfile.txt": base}, clean_first=True)
         client.run("install . --build")
 
-        qmake = load(os.path.join(client.current_folder, "conanbuildinfo.pri"))
+        qmake = client.load("conanbuildinfo.pri")
         self.assertIn("CONAN_RESDIRS += ", qmake)
         self.assertEqual(qmake.count("CONAN_LIBS += "), 1)
         self.assertIn("CONAN_LIBS_PKG_RELEASE += -lhellor", qmake)
@@ -139,7 +138,7 @@ qmake
         client.save({"conanfile.txt": base}, clean_first=True)
         client.run("install . --build")
 
-        qmake = load(os.path.join(client.current_folder, "conanbuildinfo.pri"))
+        qmake = client.load("conanbuildinfo.pri")
         self.assertIn("CONAN_RESDIRS += ", qmake)
         self.assertEqual(qmake.count("CONAN_LIBS += "), 1)
         self.assertIn("CONAN_LIBS_PKG_NAME_WORLD_RELEASE += -lhellor", qmake)
diff --git a/conans/test/functional/generators/json_test.py b/conans/test/functional/generators/json_test.py
index 5aebd68b5..0c4c7d357 100644
--- a/conans/test/functional/generators/json_test.py
+++ b/conans/test/functional/generators/json_test.py
@@ -3,7 +3,7 @@ import os
 import textwrap
 import unittest
 
-from conans.test.utils.tools import TestClient, load
+from conans.test.utils.tools import TestClient
 
 
 class JsonTest(unittest.TestCase):
@@ -24,7 +24,7 @@ class HelloConan(ConanFile):
                      "header.h": ""})
         client.run("create . Hello/0.1@lasote/testing")
         client.run("install Hello/0.1@lasote/testing -g json")
-        conan_json = load(os.path.join(client.current_folder, "conanbuildinfo.json"))
+        conan_json = client.load("conanbuildinfo.json")
         data = json.loads(conan_json)
 
         self.assertEqual(data["deps_env_info"]["MY_ENV_VAR"], "foo")
@@ -55,7 +55,7 @@ class HelloConan(ConanFile):
         client.run("create . Hello/0.1@lasote/testing " + settings)
         client.run("install Hello/0.1@lasote/testing -g json " + settings)
 
-        conan_json = load(os.path.join(client.current_folder, "conanbuildinfo.json"))
+        conan_json = client.load("conanbuildinfo.json")
         data = json.loads(conan_json)
         settings_data = data["settings"]
 
@@ -135,7 +135,7 @@ class HelloConan(ConanFile):
         client.run("create . Hello/0.1@lasote/testing")
         client.run("install Hello/0.1@lasote/testing -g json")
 
-        my_json = load(os.path.join(client.current_folder, "conanbuildinfo.json"))
+        my_json = client.load("conanbuildinfo.json")
         my_json = json.loads(my_json)
         self.assertListEqual(my_json["dependencies"][0]["libs"], ["LIB1"])
         self.assertListEqual(my_json["dependencies"][0]["system_libs"], ["SYSTEM_LIB1"])
diff --git a/conans/test/functional/generators/make_test.py b/conans/test/functional/generators/make_test.py
index c04103204..afeb8af82 100644
--- a/conans/test/functional/generators/make_test.py
+++ b/conans/test/functional/generators/make_test.py
@@ -4,7 +4,7 @@ import unittest
 
 from nose.plugins.attrib import attr
 
-from conans.client.tools import chdir, replace_in_file
+from conans.client.tools import replace_in_file
 from conans.test.utils.tools import TestClient
 
 
diff --git a/conans/test/functional/generators/premake_test.py b/conans/test/functional/generators/premake_test.py
index 53576b937..7f1fbd447 100644
--- a/conans/test/functional/generators/premake_test.py
+++ b/conans/test/functional/generators/premake_test.py
@@ -44,7 +44,7 @@ class PremakeGeneratorTest(unittest.TestCase):
     def test_generate_basic_setup_release(self):
         self.client.run("install . -s build_type=Release -s arch=x86_64 --build missing")
         self.client.run_command("premake5 vs2017")
-        sln_content = load(os.path.join(self.client.current_folder, "example.sln"))
+        sln_content = self.client.load("example.sln")
         self.assertIn("Release|x64", sln_content)
         self.assertNotIn("Debug|Win32", sln_content)
         self.assertNotIn("Debug|x64", sln_content)
@@ -52,7 +52,7 @@ class PremakeGeneratorTest(unittest.TestCase):
     def test_generate_basic_setup_debug_32bit(self):
         self.client.run("install . -s build_type=Debug -s arch=x86 --build missing")
         self.client.run_command("premake5 vs2017")
-        sln_content = load(os.path.join(self.client.current_folder, "example.sln"))
+        sln_content = self.client.load("example.sln")
         self.assertIn("Debug|Win32", sln_content)
         self.assertNotIn("Release|Win32", sln_content)
         self.assertNotIn("Release|x64", sln_content)
diff --git a/conans/test/functional/generators/virtualbuildenv_test.py b/conans/test/functional/generators/virtualbuildenv_test.py
index 30bad8d8d..489844b6d 100644
--- a/conans/test/functional/generators/virtualbuildenv_test.py
+++ b/conans/test/functional/generators/virtualbuildenv_test.py
@@ -21,7 +21,7 @@ class TestConan(ConanFile):
         client.save({"conanfile.py": conanfile})
         client.run('install . -g virtualbuildenv -s os=Windows -s compiler="Visual Studio"'
                    ' -s compiler.runtime=MD -s compiler.version=15')
-        bat = load(os.path.join(client.current_folder, "activate_build.bat"))
+        bat = client.load("activate_build.bat")
         self.assertIn("SET UseEnv=True", bat)
         self.assertIn('SET CL=-MD -DNDEBUG -O2 -Ob2 %CL%', bat)
 
diff --git a/conans/test/functional/generators/visual_studio_test.py b/conans/test/functional/generators/visual_studio_test.py
index 1162e87df..e1a24808d 100644
--- a/conans/test/functional/generators/visual_studio_test.py
+++ b/conans/test/functional/generators/visual_studio_test.py
@@ -7,7 +7,6 @@ import unittest
 
 from nose.plugins.attrib import attr
 
-from conans import load
 from conans.test.utils.tools import TestClient
 from conans.test.utils.visual_project_files import get_vs_project_files
 
diff --git a/conans/test/functional/graph/half_diamond_test.py b/conans/test/functional/graph/half_diamond_test.py
index 514c450fa..b2ccc47bb 100644
--- a/conans/test/functional/graph/half_diamond_test.py
+++ b/conans/test/functional/graph/half_diamond_test.py
@@ -49,5 +49,5 @@ class HalfDiamondTest(unittest.TestCase):
         self.client.run("install . --build missing")
         self.assertIn("conanfile.py (Hello2/0.1): Generated conaninfo.txt",
                       self.client.out)
-        conaninfo = load(os.path.join(self.client.current_folder, "conaninfo.txt"))
+        conaninfo = self.client.load("conaninfo.txt")
         self.assertEqual(1, conaninfo.count("Hello0/0.1@lasote/stable"))
diff --git a/conans/test/functional/graph/private_deps_test.py b/conans/test/functional/graph/private_deps_test.py
index 0ee32a437..716984706 100644
--- a/conans/test/functional/graph/private_deps_test.py
+++ b/conans/test/functional/graph/private_deps_test.py
@@ -32,14 +32,14 @@ class Pkg(ConanFile):
         client.save({"conanfile.py": conanfile.replace("pass", "requires='PkgA/0.1@user/channel'")})
         client.run("install . -g=cmake")
         self.assertIn("PkgC/0.1@user/channel:%s - Cache" % NO_SETTINGS_PACKAGE_ID, client.out)
-        conanbuildinfo = load(os.path.join(client.current_folder, "conanbuildinfo.txt"))
+        conanbuildinfo = client.load("conanbuildinfo.txt")
         self.assertIn("[libs];PkgA;PkgC", ";".join(conanbuildinfo.splitlines()))
         self.assertIn("PkgC/0.1/user/channel/package", conanbuildinfo)
         self.assertIn("[includedirs_PkgC]", conanbuildinfo)
         conanbuildinfo = client.load("conanbuildinfo.cmake")
         self.assertIn("set(CONAN_LIBS PkgA PkgC ${CONAN_LIBS})", conanbuildinfo)
         client.run("info . --graph=file.html")
-        html = load(os.path.join(client.current_folder, "file.html"))
+        html = client.load("file.html")
         self.assertEqual(1, html.count("label: 'PkgC/0.1', shape: 'box'"))
 
     def test_private_regression_skip(self):
diff --git a/conans/test/functional/graph/version_range_error_test.py b/conans/test/functional/graph/version_range_error_test.py
index fc5580347..2d69c8b39 100644
--- a/conans/test/functional/graph/version_range_error_test.py
+++ b/conans/test/functional/graph/version_range_error_test.py
@@ -1,6 +1,5 @@
 import unittest
 
-from conans.model.ref import ConanFileReference
 from conans.paths import CONANFILE
 from conans.test.utils.tools import TestClient, GenConanfile
 
diff --git a/conans/test/functional/graph/version_ranges_diamond_test.py b/conans/test/functional/graph/version_ranges_diamond_test.py
index b37ccbd2a..e691938b2 100644
--- a/conans/test/functional/graph/version_ranges_diamond_test.py
+++ b/conans/test/functional/graph/version_ranges_diamond_test.py
@@ -1,4 +1,3 @@
-import os
 import textwrap
 import unittest
 from collections import OrderedDict
diff --git a/conans/test/functional/graph_lock/graph_lock_test.py b/conans/test/functional/graph_lock/graph_lock_test.py
index f28d7ce88..653997755 100644
--- a/conans/test/functional/graph_lock/graph_lock_test.py
+++ b/conans/test/functional/graph_lock/graph_lock_test.py
@@ -65,7 +65,7 @@ class GraphLockCustomFilesTest(unittest.TestCase):
 
     def _check_lock(self, ref_b, rev_b=""):
         ref_b = repr(ConanFileReference.loads(ref_b))
-        lock_file = load(os.path.join(self.client.current_folder, "custom.lock"))
+        lock_file = self.client.load("custom.lock")
         lock_file_json = json.loads(lock_file)
         self.assertEqual(lock_file_json["version"], LOCKFILE_VERSION)
         self.assertEqual(2, len(lock_file_json["graph_lock"]["nodes"]))
diff --git a/conans/test/functional/old/conanfile_extend_test.py b/conans/test/functional/old/conanfile_extend_test.py
index 18531b43b..b2c039413 100644
--- a/conans/test/functional/old/conanfile_extend_test.py
+++ b/conans/test/functional/old/conanfile_extend_test.py
@@ -1,8 +1,6 @@
-import os
 import unittest
 
 from conans.test.utils.tools import TestClient
-from conans.util.files import load
 
 
 class ConanfileExtendTest(unittest.TestCase):
diff --git a/conans/test/functional/old/path_exists_test.py b/conans/test/functional/old/path_exists_test.py
index a13560c23..e31c70e7d 100644
--- a/conans/test/functional/old/path_exists_test.py
+++ b/conans/test/functional/old/path_exists_test.py
@@ -26,7 +26,7 @@ class PathExistsTest(unittest.TestCase):
         self.client = TestClient(servers=self.servers, users={"default": [("lasote", "mypass")]})
         self.client.save({"conanfile.txt": "[requires]\nHello0/0.1@lasote/stable\n[generators]\ntxt"})
         self.client.run("install . --build missing ")
-        build_info = load(os.path.join(self.client.current_folder, "conanbuildinfo.txt"))
+        build_info = self.client.load("conanbuildinfo.txt")
         self.assertIn("helloHello0", build_info)
 
         self.client = TestClient(servers=self.servers, users={"default": [("lasote", "mypass")]})
diff --git a/conans/test/functional/old/sysroot_test.py b/conans/test/functional/old/sysroot_test.py
index 01b5d16ff..c93402502 100644
--- a/conans/test/functional/old/sysroot_test.py
+++ b/conans/test/functional/old/sysroot_test.py
@@ -40,6 +40,6 @@ class Pkg(ConanFile):
 
         # Install conanfile and check conaninfo.txt
         client.run("install .")
-        bili = load(os.path.join(client.current_folder, "conanbuildinfo.txt"))
+        bili = client.load("conanbuildinfo.txt")
         self.assertIn(os.linesep.join(["[sysroot_sysroot]", "HelloSysRoot"]), bili)
         self.assertIn(os.linesep.join(["[sysroot]", "HelloSysRoot"]), bili)
diff --git a/conans/test/functional/old/user_info_test.py b/conans/test/functional/old/user_info_test.py
index c84c2f201..5e65d9ee6 100644
--- a/conans/test/functional/old/user_info_test.py
+++ b/conans/test/functional/old/user_info_test.py
@@ -58,7 +58,7 @@ class MyConanfile(ConanFile):
         client.run('install reuse/0.1@lasote/stable --build -g txt')
 
         # Assert generator TXT
-        txt_contents = load(os.path.join(client.current_folder, "conanbuildinfo.txt"))
+        txt_contents = client.load("conanbuildinfo.txt")
         self.assertIn("[USER_LIB_A]%sVAR1=2" % os.linesep, txt_contents)
         self.assertIn("[USER_LIB_B]%sVAR1=2%sVAR2=3" % (os.linesep, os.linesep), txt_contents)
         self.assertIn("[USER_LIB_C]%sVAR1=2" % os.linesep, txt_contents)
diff --git a/conans/test/functional/package_id/compatible_test.py b/conans/test/functional/package_id/compatible_test.py
index be42a12ea..652360501 100644
--- a/conans/test/functional/package_id/compatible_test.py
+++ b/conans/test/functional/package_id/compatible_test.py
@@ -4,7 +4,6 @@ import unittest
 
 from conans.model.ref import ConanFileReference
 from conans.test.utils.tools import TestClient, GenConanfile
-from conans.util.env_reader import get_env
 
 
 class CompatibleIDsTest(unittest.TestCase):
diff --git a/conans/test/functional/python_requires/python_package_reuse_test.py b/conans/test/functional/python_requires/python_package_reuse_test.py
index d19350e1f..73bd372af 100644
--- a/conans/test/functional/python_requires/python_package_reuse_test.py
+++ b/conans/test/functional/python_requires/python_package_reuse_test.py
@@ -5,7 +5,7 @@ from conans.model.info import ConanInfo
 from conans.paths import BUILD_INFO, CONANFILE
 from conans.test.utils.test_files import temp_folder
 from conans.test.utils.tools import TestClient, TestServer
-from conans.util.files import load, save
+from conans.util.files import save
 
 conanfile = """from conans import ConanFile
 
diff --git a/conans/test/functional/python_requires/python_requires_test.py b/conans/test/functional/python_requires/python_requires_test.py
index 5fb3e879f..c3f774b4c 100644
--- a/conans/test/functional/python_requires/python_requires_test.py
+++ b/conans/test/functional/python_requires/python_requires_test.py
@@ -9,7 +9,6 @@ from conans.model.ref import ConanFileReference
 from conans.paths import CONANFILE
 from conans.test.utils.tools import TestClient, TestServer, \
     NO_SETTINGS_PACKAGE_ID, create_local_git_repo, GenConanfile
-from conans.util.files import load
 
 
 class PythonExtendTest(unittest.TestCase):
@@ -250,7 +249,7 @@ class MyConanfileBase(source.SourceBuild, package.PackageInfo):
             """)
         client.save({"conanfile.py": conanfile})
         client.run("install . pkg/0.1@user/channel")
-        lockfile = load(os.path.join(client.current_folder, "conan.lock"))
+        lockfile = client.load("conan.lock")
         self.assertIn("base/1.0@user/channel#e41727b922c6ae54b216a58442893f3a", lockfile)
         self.assertIn("helper/1.0@user/channel#98457e1f8d9174ed053747634ce0ea1a", lockfile)
         client.run("source .")
diff --git a/conans/test/integration/build_id_test.py b/conans/test/integration/build_id_test.py
index a0ba2e36d..a70e4e4b5 100644
--- a/conans/test/integration/build_id_test.py
+++ b/conans/test/integration/build_id_test.py
@@ -118,13 +118,13 @@ class BuildIdTest(unittest.TestCase):
                       client.out)
         self.assertIn("Building my code!", client.out)
         self.assertIn("Packaging Debug!", client.out)
-        content = load(os.path.join(client.current_folder, "file1.txt"))
+        content = client.load("file1.txt")
         self.assertEqual("Debug file1", content)
         # Package Windows Release, it will reuse the previous build
         client.run('install . -s os=Windows -s build_type=Release')
         self.assertNotIn("Building my code!", client.out)
         self.assertIn("Packaging Release!", client.out)
-        content = load(os.path.join(client.current_folder, "file1.txt"))
+        content = client.load("file1.txt")
         self.assertEqual("Release file1", content)
 
         # Now Linux Debug
@@ -133,13 +133,13 @@ class BuildIdTest(unittest.TestCase):
                       client.out)
         self.assertIn("Building my code!", client.out)
         self.assertIn("Packaging Debug!", client.out)
-        content = load(os.path.join(client.current_folder, "file1.txt"))
+        content = client.load("file1.txt")
         self.assertEqual("Debug file1", content)
         # Linux Release must build again, as it is not affected by build_id()
         client.run('install . -s os=Linux -s build_type=Release')
         self.assertIn("Building my code!", client.out)
         self.assertIn("Packaging Release!", client.out)
-        content = load(os.path.join(client.current_folder, "file1.txt"))
+        content = client.load("file1.txt")
         self.assertEqual("Release file1", content)
         self._check_conaninfo(client)
 
@@ -149,13 +149,13 @@ class BuildIdTest(unittest.TestCase):
         client.run('install . -s os=Windows -s build_type=Debug')
         self.assertNotIn("Building my code!", client.out)
         self.assertIn("Packaging Debug!", client.out)
-        content = load(os.path.join(client.current_folder, "file1.txt"))
+        content = client.load("file1.txt")
         self.assertEqual("Debug file1", content)
         # Windows Release
         client.run('install . -s os=Windows -s build_type=Release')
         self.assertNotIn("Building my code!", client.out)
         self.assertIn("Packaging Release!", client.out)
-        content = load(os.path.join(client.current_folder, "file1.txt"))
+        content = client.load("file1.txt")
         self.assertEqual("Release file1", content)
         # Now Linux
         client.run('install . -s os=Linux -s build_type=Debug')
@@ -163,12 +163,12 @@ class BuildIdTest(unittest.TestCase):
                       client.out)
         self.assertIn("Building my code!", client.out)
         self.assertIn("Packaging Debug!", client.out)
-        content = load(os.path.join(client.current_folder, "file1.txt"))
+        content = client.load("file1.txt")
         self.assertEqual("Debug file1", content)
         client.run('install . -s os=Linux -s build_type=Release')
         self.assertIn("Building my code!", client.out)
         self.assertIn("Packaging Release!", client.out)
-        content = load(os.path.join(client.current_folder, "file1.txt"))
+        content = client.load("file1.txt")
         self.assertEqual("Release file1", content)
         self._check_conaninfo(client)
 
@@ -177,23 +177,23 @@ class BuildIdTest(unittest.TestCase):
         client.run('install . -s os=Windows -s build_type=Debug')
         self.assertNotIn("Building my code!", client.out)
         self.assertNotIn("Packaging Debug!", client.out)
-        content = load(os.path.join(client.current_folder, "file1.txt"))
+        content = client.load("file1.txt")
         self.assertEqual("Debug file1", content)
         client.run('install . -s os=Windows -s build_type=Release')
         self.assertNotIn("Building my code!", client.out)
         self.assertNotIn("Packaging Release!", client.out)
-        content = load(os.path.join(client.current_folder, "file1.txt"))
+        content = client.load("file1.txt")
         self.assertEqual("Release file1", content)
         # Now Linux
         client.run('install . -s os=Linux -s build_type=Debug')
         self.assertNotIn("Building my code!", client.out)
         self.assertNotIn("Packaging Debug!", client.out)
-        content = load(os.path.join(client.current_folder, "file1.txt"))
+        content = client.load("file1.txt")
         self.assertEqual("Debug file1", content)
         client.run('install . -s os=Linux -s build_type=Release')
         self.assertNotIn("Building my code!", client.out)
         self.assertNotIn("Packaging Release!", client.out)
-        content = load(os.path.join(client.current_folder, "file1.txt"))
+        content = client.load("file1.txt")
         self.assertEqual("Release file1", content)
         self._check_conaninfo(client)
 
diff --git a/conans/test/integration/order_libs_test.py b/conans/test/integration/order_libs_test.py
index 425f45279..bb4c069b2 100644
--- a/conans/test/integration/order_libs_test.py
+++ b/conans/test/integration/order_libs_test.py
@@ -110,9 +110,9 @@ class HelloReuseConan(ConanFile):
 
         expected_libs = ['SDL2_ttf', 'freeType', 'SDL2', 'rt', 'pthread', 'dl',
                          'BZip2', 'LibPNG', 'm', 'ZLib']
-        conanbuildinfo = load(os.path.join(self.client.current_folder, "conanbuildinfo.txt"))
+        conanbuildinfo = self.client.load("conanbuildinfo.txt")
         libs = os.linesep.join(expected_libs)
         self.assertIn(libs, conanbuildinfo)
-        conanbuildinfo = load(os.path.join(self.client.current_folder, "conanbuildinfo.cmake"))
+        conanbuildinfo = self.client.load("conanbuildinfo.cmake")
         libs = " ".join(expected_libs)
         self.assertIn(libs, conanbuildinfo)
diff --git a/conans/test/unittests/client/cmd/export_test.py b/conans/test/unittests/client/cmd/export_test.py
index a62322c25..aa2f3acc5 100644
--- a/conans/test/unittests/client/cmd/export_test.py
+++ b/conans/test/unittests/client/cmd/export_test.py
@@ -5,7 +5,6 @@ from collections import namedtuple
 
 from conans.client.cmd.export import _replace_scm_data_in_conanfile
 from conans.client.loader import _parse_conanfile
-from conans.client.tools import chdir
 from conans.model.ref import ConanFileReference
 from conans.model.scm import SCMData
 from conans.test.utils.test_files import temp_folder
diff --git a/conans/test/unittests/client/generators/cmake_paths_test.py b/conans/test/unittests/client/generators/cmake_paths_test.py
index ea09657e3..f6afdfc54 100644
--- a/conans/test/unittests/client/generators/cmake_paths_test.py
+++ b/conans/test/unittests/client/generators/cmake_paths_test.py
@@ -1,6 +1,5 @@
 import os
 import unittest
-from collections import namedtuple
 
 from conans.client.generators.cmake_paths import CMakePathsGenerator
 from conans.model.build_info import CppInfo
diff --git a/conans/test/unittests/client/generators/cmake_test.py b/conans/test/unittests/client/generators/cmake_test.py
index 6acbb10dc..3acbd6e9a 100644
--- a/conans/test/unittests/client/generators/cmake_test.py
+++ b/conans/test/unittests/client/generators/cmake_test.py
@@ -1,11 +1,8 @@
 import os
-import platform
 import re
-import textwrap
 import unittest
 
 import six
-from parameterized import parameterized
 
 from conans.client.build.cmake_flags import CMakeDefinitionsBuilder
 from conans.client.conf import default_settings_yml
@@ -20,9 +17,8 @@ from conans.model.ref import ConanFileReference
 from conans.model.settings import Settings
 from conans.test.utils.test_files import temp_folder
 from conans.test.utils.tools import TestBufferConanOutput
-from conans.test.utils.tools import TestClient
 from conans.util.files import save
-from conans.test.utils.tools import TestClient, GenConanfile
+
 
 class _MockSettings(object):
     build_type = None
diff --git a/conans/test/unittests/tools/files_patch_test.py b/conans/test/unittests/tools/files_patch_test.py
index 4508f64c0..4dd65bf16 100644
--- a/conans/test/unittests/tools/files_patch_test.py
+++ b/conans/test/unittests/tools/files_patch_test.py
@@ -7,8 +7,7 @@ from parameterized.parameterized import parameterized
 from conans.client.graph.python_requires import ConanPythonRequire
 from conans.client.loader import ConanFileLoader
 from conans.test.utils.test_files import temp_folder
-from conans.test.utils.tools import TestClient, TestBufferConanOutput,\
-    test_profile
+from conans.test.utils.tools import TestClient, TestBufferConanOutput, test_profile
 from conans.util.files import save, load
 
 base_conanfile = '''
@@ -82,8 +81,7 @@ class ToolsFilesPatchTest(unittest.TestCase):
         client.save({"conanfile.py": conanfile,
                      "example.patch": patch})
         client.run("source .")
-        self.assertEqual(load(os.path.join(client.current_folder, "newfile")),
-                         "New file!")
+        self.assertEqual(client.load("newfile"), "New file!")
 
     def test_patch_strip_delete(self):
         conanfile = dedent("""
@@ -249,10 +247,10 @@ class ToolsFilesPatchTest(unittest.TestCase):
                      "bar.txt": bar})
         client.run("install .")
         client.run("build .")
-        bar_content = load(os.path.join(client.current_folder, "bar.txt"))
+        bar_content = client.load("bar.txt")
         self.assertIn(dedent("""Yo no creo en brujas, pero que las hay, las hay
                              """), bar_content)
-        foo_content = load(os.path.join(client.current_folder, "foo.txt"))
+        foo_content = client.load("foo.txt")
         self.assertIn(dedent("""For us, there is no spring.
 Just the wind that smells fresh before the storm."""), foo_content)
         self.assertIn("Running build()", client.out)
@@ -314,5 +312,5 @@ Z""")
                      "Jamroot": source})
         client.run("install .")
         client.run("build .")
-        content = load(os.path.join(client.current_folder, "Jamroot"))
+        content = client.load("Jamroot")
         self.assertIn(expected, content)
diff --git a/conans/test/unittests/util/conanfile_tools_test.py b/conans/test/unittests/util/conanfile_tools_test.py
index e58cacf78..d6bc33db6 100644
--- a/conans/test/unittests/util/conanfile_tools_test.py
+++ b/conans/test/unittests/util/conanfile_tools_test.py
@@ -36,8 +36,7 @@ class Pkg(ConanFile):
         client.save({"conanfile.py": conanfile,
                      "myfile.txt": "World"})
         client.run("source .")
-        self.assertEqual("WorldHello",
-                         load(os.path.join(client.current_folder, "myfile.txt")))
+        self.assertEqual("WorldHello", client.load("myfile.txt"))
 
     def test_untar(self):
         tmp_dir = temp_folder()
diff --git a/conans/test/utils/tools.py b/conans/test/utils/tools.py
index aa9e3f82e..5c9369142 100644
--- a/conans/test/utils/tools.py
+++ b/conans/test/utils/tools.py
@@ -10,7 +10,6 @@ import sys
 import tempfile
 import threading
 import unittest
-import textwrap
 import uuid
 from collections import Counter, OrderedDict
 from contextlib import contextmanager
@@ -1236,7 +1235,8 @@ class TurboTestClient(TestClient):
     def create(self, ref, conanfile=GenConanfile(), args=None, assert_error=False):
         if conanfile:
             self.save({"conanfile.py": conanfile})
-        self.run("create . {} {} --json {}".format(ref.full_str(),
+        full_str = "{}@".format(ref.full_str()) if not ref.user else ref.full_str()
+        self.run("create . {} {} --json {}".format(full_str,
                                                    args or "", self.tmp_json_name),
                  assert_error=assert_error)
         rrev = self.cache.package_layout(ref).recipe_revision()