diff --git a/conans/requirements_dev.txt b/conans/requirements_dev.txt index 31362d4967d..c553973ebe9 100644 --- a/conans/requirements_dev.txt +++ b/conans/requirements_dev.txt @@ -1,6 +1,7 @@ nose>=1.3.7, <1.4.0 pytest>=6.1.1, <7.0.0; python_version > '3.0' pytest>=4.6.11; python_version < '3.0' +pytest-xdist # To launch in N cores with pytest -n parameterized>=0.6.3 mock>=1.3.0, <1.4.0 WebTest>=2.0.18, <2.1.0 diff --git a/conans/test/conan_v2/test_default_config.py b/conans/test/conan_v2/test_default_config.py index a8bc21a2f8d..f828d27c4ff 100644 --- a/conans/test/conan_v2/test_default_config.py +++ b/conans/test/conan_v2/test_default_config.py @@ -1,6 +1,8 @@ import platform import unittest +import pytest + from conans.test.utils.conan_v2_tests import ConanV2ModeTestCase @@ -27,6 +29,7 @@ def test_package_id_mode(self): # self.assertEqual(str(t.out).strip(), "semver_direct_mode") @unittest.skipUnless(platform.system() == "Linux", "OLD ABI is only detected for Linux/gcc") + @pytest.mark.tool_gcc() def test_default_libcxx(self): t = self.get_client() t.run('profile new --detect autodetected') diff --git a/conans/test/conftest.py b/conans/test/conftest.py new file mode 100644 index 00000000000..6fb26e3f04e --- /dev/null +++ b/conans/test/conftest.py @@ -0,0 +1,57 @@ +import pytest +from conans.errors import ConanException + +from conans.client.tools import vswhere, which + +tools_available = [ + 'cmake', + 'gcc', 'clang', 'visual_studio', + 'autotools', 'pkg_config', 'premake', + 'file', + 'git', 'svn', + 'compiler' +] + +if not which("cmake"): + tools_available.remove("cmake") + +if not which("gcc"): + tools_available.remove("gcc") +if not which("clang"): + tools_available.remove("clang") +try: + vswhere() +except ConanException: + tools_available.remove("visual_studio") + +if not any([x for x in ("gcc", "clang", "visual_sudio") if x in tools_available]): + tools_available.remove("compiler") + + +if not which("file"): + tools_available.remove("file") + +if not which("git"): + tools_available.remove("git") +if not which("svn"): + tools_available.remove("svn") + +if not which("autoconf") or not which("automake"): + tools_available.remove("autotools") +if not which("pkg-config"): + tools_available.remove("pkg_config") +if not which("premake"): + tools_available.remove("premake") + + +def tool_check(mark): + tool_name = mark.name[5:] + if tool_name not in tools_available: + pytest.skip("required {} not satisfied".format(tool_name)) + + +def pytest_runtest_setup(item): + # Every mark is a required tool, some specify a version + for mark in item.iter_markers(): + if mark.name.startswith("tool_"): + return tool_check(mark) diff --git a/conans/test/functional/build_helpers/autotools_environment_test.py b/conans/test/functional/build_helpers/autotools_environment_test.py index ac1d744dbaf..0f0d6d9fd47 100644 --- a/conans/test/functional/build_helpers/autotools_environment_test.py +++ b/conans/test/functional/build_helpers/autotools_environment_test.py @@ -2,6 +2,8 @@ import platform import unittest +import pytest + from conans.client import tools from conans.model.ref import ConanFileReference, PackageReference from conans.paths import CONANFILE @@ -51,7 +53,8 @@ def _set_deps_info(self, conanfile): conanfile.deps_cpp_info.exelinkflags.append("exe_link_flag") conanfile.deps_cpp_info.sysroot = "/path/to/folder" - @unittest.skipUnless(platform.system() == "Linux", "Requires make") + @unittest.skipUnless(platform.system() == "Linux", "Requires Autotools") + @pytest.mark.tool_autotools() def test_autotools_real_install_dirs(self): body = gen_function_cpp(name="hello", msg="Hola Mundo!") header = gen_function_h(name="hello") diff --git a/conans/test/functional/build_helpers/cmake_configs_test.py b/conans/test/functional/build_helpers/cmake_configs_test.py index ff018f70791..1a3058ecaea 100644 --- a/conans/test/functional/build_helpers/cmake_configs_test.py +++ b/conans/test/functional/build_helpers/cmake_configs_test.py @@ -10,6 +10,7 @@ @attr("slow") @pytest.mark.slow +@pytest.mark.tool_cmake class CMakeConfigsTest(unittest.TestCase): def test_test_package_configs(self): diff --git a/conans/test/functional/build_helpers/cmake_flags_test.py b/conans/test/functional/build_helpers/cmake_flags_test.py index 35c1a391d64..3846f6aee9c 100644 --- a/conans/test/functional/build_helpers/cmake_flags_test.py +++ b/conans/test/functional/build_helpers/cmake_flags_test.py @@ -63,6 +63,7 @@ def package_info(self): @attr("slow") @pytest.mark.slow +@pytest.mark.tool_cmake class CMakeFlagsTest(unittest.TestCase): def _get_line(self, text, begin): diff --git a/conans/test/functional/build_helpers/cmake_folders_test.py b/conans/test/functional/build_helpers/cmake_folders_test.py index 9a0905731d5..9aa09615776 100644 --- a/conans/test/functional/build_helpers/cmake_folders_test.py +++ b/conans/test/functional/build_helpers/cmake_folders_test.py @@ -1,12 +1,14 @@ import os import unittest +import pytest from parameterized import parameterized from conans.test.utils.tools import TestClient from conans.util.files import load, mkdir - +@pytest.mark.slow +@pytest.mark.tool_cmake class CMakeFoldersTest(unittest.TestCase): @parameterized.expand([(True, True), (False, True), (True, False), (False, False)]) diff --git a/conans/test/functional/build_helpers/cmake_install_package_test.py b/conans/test/functional/build_helpers/cmake_install_package_test.py index 4496b1218cb..697c7f420b3 100644 --- a/conans/test/functional/build_helpers/cmake_install_package_test.py +++ b/conans/test/functional/build_helpers/cmake_install_package_test.py @@ -1,10 +1,13 @@ import unittest +import pytest + from conans.test.utils.tools import TestClient class CMakeInstallPackageTest(unittest.TestCase): + @pytest.mark.tool_compiler def test_patch_config(self): client = TestClient() conanfile = """from conans import ConanFile, CMake @@ -43,6 +46,7 @@ def package(self): self.assertIn("ConanException: cmake.patch_config_paths() can't work without package name", client.out) + @pytest.mark.tool_cmake def test_install_package(self): client = TestClient() conanfile = """from conans import ConanFile, CMake diff --git a/conans/test/functional/build_helpers/cmake_targets_test.py b/conans/test/functional/build_helpers/cmake_targets_test.py index 5803ac246d7..49cf528be33 100644 --- a/conans/test/functional/build_helpers/cmake_targets_test.py +++ b/conans/test/functional/build_helpers/cmake_targets_test.py @@ -77,6 +77,7 @@ class Alpha(ConanFile): self.assertIn('set(CONAN_SHARED_LINKER_FLAGS ' '"CharlieFlag BetaFlag ${CONAN_SHARED_LINKER_FLAGS}")', cmake) + @pytest.mark.tool_cmake def test_header_only(self): client = TestClient() client.save({"conanfile.py": conanfile_py, diff --git a/conans/test/functional/build_helpers/cmake_test.py b/conans/test/functional/build_helpers/cmake_test.py index 7bf7ce63d7d..998ef46c432 100644 --- a/conans/test/functional/build_helpers/cmake_test.py +++ b/conans/test/functional/build_helpers/cmake_test.py @@ -1,9 +1,12 @@ import textwrap import unittest +import pytest + from conans.test.utils.tools import TestClient +@pytest.mark.tool_cmake class CMakeBuildHelper(unittest.TestCase): def test_get_version_no_toolchain(self): client = TestClient() diff --git a/conans/test/functional/build_helpers/pkg_config_test.py b/conans/test/functional/build_helpers/pkg_config_test.py index ee55fdf38b4..8f8f715c841 100644 --- a/conans/test/functional/build_helpers/pkg_config_test.py +++ b/conans/test/functional/build_helpers/pkg_config_test.py @@ -2,6 +2,8 @@ import textwrap import unittest +import pytest + from conans.test.utils.tools import TestClient hello_cpp = """ @@ -66,6 +68,7 @@ def package_info(self): @unittest.skipIf(platform.system() == "Windows", ".pc files not in Win") +@pytest.mark.tool_pkg_config class PkgConfigTest(unittest.TestCase): """ Test WITHOUT a build helper nor a generator, explicitly defining pkg-config in the diff --git a/conans/test/functional/build_requires/profile_build_requires_testing_test.py b/conans/test/functional/build_requires/profile_build_requires_testing_test.py index d510f288b5e..20dc2f60308 100644 --- a/conans/test/functional/build_requires/profile_build_requires_testing_test.py +++ b/conans/test/functional/build_requires/profile_build_requires_testing_test.py @@ -60,6 +60,7 @@ def build(self): @attr("slow") @pytest.mark.slow +@pytest.mark.tool_cmake class BuildRequiresTest(unittest.TestCase): def test_test_framework(self): diff --git a/conans/test/functional/case_sensitive_test.py b/conans/test/functional/case_sensitive_test.py index d95a2df1a62..6883d16a9d2 100644 --- a/conans/test/functional/case_sensitive_test.py +++ b/conans/test/functional/case_sensitive_test.py @@ -2,6 +2,8 @@ import textwrap import unittest +import pytest + from conans.paths import CONANFILE from conans.test.assets.cpp_test_files import cpp_hello_conan_files from conans.test.utils.tools import TestClient, TestServer @@ -21,6 +23,7 @@ def source(self): @unittest.skipIf(platform.system() == 'Linux', "Only for case insensitive OS") class CaseSensitiveTest(unittest.TestCase): + @pytest.mark.tool_compiler def test_install(self): test_server = TestServer() servers = {"default": test_server} diff --git a/conans/test/functional/command/build_test.py b/conans/test/functional/command/build_test.py index 0d51db73159..9d3e83d2ab9 100644 --- a/conans/test/functional/command/build_test.py +++ b/conans/test/functional/command/build_test.py @@ -2,6 +2,8 @@ import textwrap import unittest +import pytest + from conans.model.ref import PackageReference from conans.paths import BUILD_INFO, CONANFILE from conans.test.utils.tools import NO_SETTINGS_PACKAGE_ID, TestClient @@ -242,6 +244,7 @@ def build(self): self.assertIn("Hello.Pkg/0.1/lasote/testing", client.out) self.assertIn("Hello-Tools/0.1/lasote/testing", client.out) + @pytest.mark.tool_cmake def test_build_cmake_install(self): client = TestClient() conanfile = """ diff --git a/conans/test/functional/command/config_install_test.py b/conans/test/functional/command/config_install_test.py index 8fdaf28dbf8..309015ee4d6 100644 --- a/conans/test/functional/command/config_install_test.py +++ b/conans/test/functional/command/config_install_test.py @@ -6,6 +6,7 @@ import unittest import zipfile +import pytest import six from mock import patch @@ -386,6 +387,7 @@ def test_failed_install_http(self): self.assertIn("ERROR: Failed conan config install: " "Error while installing config from httpnonexisting", self.client.out) + @pytest.mark.tool_git def test_install_repo(self): """ should install from a git repo """ @@ -402,6 +404,7 @@ def test_install_repo(self): check_path = os.path.join(folder, ".git") self._check("git, %s, True, None" % check_path) + @pytest.mark.tool_git def test_install_repo_relative(self): relative_folder = "./config" absolute_folder = os.path.join(self.client.current_folder, "config") @@ -417,6 +420,7 @@ def test_install_repo_relative(self): self.client.run('config install "%s/.git"' % relative_folder) self._check("git, %s, True, None" % os.path.join("%s" % folder, ".git")) + @pytest.mark.tool_git def test_install_custom_args(self): """ should install from a git repo """ @@ -529,6 +533,7 @@ def download_verify_true(obj, url, filename, **kwargs): # @UnusedVariable with patch.object(FileDownloader, 'download', new=download_verify_true): self.client.run("config install %s --verify-ssl=True" % fake_url) + @pytest.mark.tool_git def test_git_checkout_is_possible(self): folder = self._create_profile_folder() with self.client.chdir(folder): @@ -701,6 +706,7 @@ def test_invalid_time_interval(self): self.assertIn("ERROR: Incorrect definition of general.config_install_interval: 1s", self.client.out) + @pytest.mark.tool_git def test_config_install_remove_git_repo(self): """ config_install_interval must break when remote git has been removed """ @@ -726,6 +732,7 @@ def test_config_install_remove_git_repo(self): self.client.run("config --help") self.assertIn("Repo cloned!", self.client.out) + @pytest.mark.tool_git def test_config_install_remove_config_repo(self): """ config_install_interval should not run when config list is empty """ diff --git a/conans/test/functional/command/devflow_test.py b/conans/test/functional/command/devflow_test.py index b0449aecc61..5f04fc9025e 100644 --- a/conans/test/functional/command/devflow_test.py +++ b/conans/test/functional/command/devflow_test.py @@ -1,6 +1,8 @@ import os import unittest +import pytest + from conans.client import tools from conans.model.ref import ConanFileReference from conans.test.utils.tools import TestClient @@ -232,6 +234,7 @@ def test_child_build(self): os.listdir(cache_package_folder)[0]) self._assert_pkg(cache_package_folder) + @pytest.mark.tool_compiler def test_build_local_different_folders(self): # Real build, needed to ensure that the generator is put in the correct place and # cmake finds it, using an install_folder different from build_folder diff --git a/conans/test/functional/command/download/download_selected_packages_test.py b/conans/test/functional/command/download/download_selected_packages_test.py index 6a3afd70566..65e81047067 100644 --- a/conans/test/functional/command/download/download_selected_packages_test.py +++ b/conans/test/functional/command/download/download_selected_packages_test.py @@ -1,13 +1,15 @@ import os import unittest +import pytest + from conans.model.ref import ConanFileReference, PackageReference from conans.paths import CONANFILE from conans.test.assets.cpp_test_files import cpp_hello_conan_files from conans.test.utils.tools import TestClient, TestServer from conans.util.files import load - +@pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected class DownloadSelectedPackagesTest(unittest.TestCase): def setUp(self): diff --git a/conans/test/functional/command/export/export_test.py b/conans/test/functional/command/export/export_test.py index b2d9d401201..e70db56e9bd 100644 --- a/conans/test/functional/command/export/export_test.py +++ b/conans/test/functional/command/export/export_test.py @@ -3,6 +3,7 @@ import textwrap import unittest +import pytest from parameterized import parameterized from conans.model.manifest import FileTreeManifest @@ -403,6 +404,7 @@ def test_revision_mode_hash(self): meta = t.cache.package_layout(ref, short_paths=False).load_metadata() self.assertEqual(meta.recipe.revision, self.summary_hash) + @pytest.mark.tool_git def test_revision_mode_scm(self): t = TestClient() commit = t.init_git_repo({'conanfile.py': self.conanfile.format(revision_mode="scm")}) diff --git a/conans/test/functional/command/info/info_command_test.py b/conans/test/functional/command/info/info_command_test.py index 40e401bf95e..9dac95ec3ef 100644 --- a/conans/test/functional/command/info/info_command_test.py +++ b/conans/test/functional/command/info/info_command_test.py @@ -1,13 +1,15 @@ import os import unittest +import pytest + from conans.paths import CONANFILE from conans.test.assets.cpp_test_files import cpp_hello_conan_files from conans.test.utils.test_files import temp_folder from conans.test.utils.tools import TestClient, TestServer from conans.util.files import load, save - +@pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected class InfoTest(unittest.TestCase): def setUp(self): diff --git a/conans/test/functional/command/info/info_options_test.py b/conans/test/functional/command/info/info_options_test.py index 0445ec70a5c..95075cd7bf1 100644 --- a/conans/test/functional/command/info/info_options_test.py +++ b/conans/test/functional/command/info/info_options_test.py @@ -1,8 +1,11 @@ import unittest +import pytest + from conans.test.utils.tools import TestClient +@pytest.mark.tool_compiler class InfoOptionsTest(unittest.TestCase): def test_info_options(self): diff --git a/conans/test/functional/command/info/info_test.py b/conans/test/functional/command/info/info_test.py index 65358166bf6..a9a9cef9dc6 100644 --- a/conans/test/functional/command/info/info_test.py +++ b/conans/test/functional/command/info/info_test.py @@ -5,6 +5,8 @@ import unittest from datetime import datetime +import pytest + from conans import __version__ as client_version from conans.model.ref import ConanFileReference from conans.paths import CONANFILE @@ -106,6 +108,7 @@ def test_install_folder(self): self.assertIn("--install-folder cannot be used together with a" " host profile (-s, -o, -e or -pr)", client.out) + @pytest.mark.tool_compiler def test_graph(self): self.client = TestClient() @@ -175,6 +178,7 @@ def check_file(filename): dot_file = os.path.join(self.client.current_folder, arg_filename) check_file(dot_file) + @pytest.mark.tool_compiler def test_graph_html(self): self.client = TestClient() @@ -250,6 +254,7 @@ def test_info_build_requires(self): "shape: 'ellipse',\n " "color: { background: 'SkyBlue'},", html) + @pytest.mark.tool_compiler def test_only_names(self): self.client = TestClient() self._create("Hello0", "0.1") @@ -288,6 +293,7 @@ def test_cwd(self): path = os.path.join(client.current_folder, "jsonfile.txt") self.assertTrue(os.path.exists(path)) + @pytest.mark.tool_compiler def test_info_virtual(self): # Checking that "Required by: virtual" doesnt appear in the output self.client = TestClient() @@ -296,6 +302,7 @@ def test_info_virtual(self): self.assertNotIn("virtual", self.client.out) self.assertNotIn("Required", self.client.out) + @pytest.mark.tool_compiler def test_reuse(self): self.client = TestClient() self._create("Hello0", "0.1") @@ -405,6 +412,7 @@ def clean_output(output): las hay""") self.assertIn(expected_output, clean_output(self.client.out)) + @pytest.mark.tool_compiler def test_json_info_outputs(self): self.client = TestClient() self._create("LibA", "0.1") @@ -429,6 +437,7 @@ def test_json_info_outputs(self): self.assertEqual(content[1]["url"], "myurl") self.assertEqual(content[1]["required_by"][0], "conanfile.py (LibD/0.1)") + @pytest.mark.tool_compiler def test_build_order(self): self.client = TestClient() self._create("Hello0", "0.1") @@ -497,6 +506,7 @@ def test_build_order_privates(self): "[Pkg/0.1@user/channel, Pkg2/0.1@user/channel]", client.out) + @pytest.mark.tool_compiler def test_diamond_build_order(self): self.client = TestClient() self._create("LibA", "0.1") diff --git a/conans/test/functional/command/install/install_outdated_test.py b/conans/test/functional/command/install/install_outdated_test.py index 0e9e2459b6c..d595f202d32 100644 --- a/conans/test/functional/command/install/install_outdated_test.py +++ b/conans/test/functional/command/install/install_outdated_test.py @@ -2,6 +2,8 @@ import unittest from collections import OrderedDict +import pytest + from conans.model.ref import ConanFileReference from conans.test.assets.cpp_test_files import cpp_hello_conan_files from conans.test.utils.tools import TestClient, TestServer, TurboTestClient, GenConanfile @@ -9,6 +11,7 @@ from conans.util.files import rmdir +@pytest.mark.tool_compiler class InstallOutdatedPackagesTest(unittest.TestCase): def setUp(self): diff --git a/conans/test/functional/command/install/install_test.py b/conans/test/functional/command/install/install_test.py index fa74ae49c51..d49dc41d762 100644 --- a/conans/test/functional/command/install/install_test.py +++ b/conans/test/functional/command/install/install_test.py @@ -4,6 +4,8 @@ import unittest from collections import OrderedDict +import pytest + from conans.client.tools.oss import detected_os from conans.model.info import ConanInfo from conans.model.ref import ConanFileReference, PackageReference @@ -422,6 +424,7 @@ def test_change_option_txt(self): self.assertIn("Hello0/0.1@lasote/stable:2e38bbc2c3ef1425197c8e2ffa8532894c347d26", conan_info.full_requires.dumps()) + @pytest.mark.tool_compiler def test_cross_platform_msg(self): # Explicit with os_build and os_arch settings message = "Cross-build from 'Linux:x86_64' to 'Windows:x86_64'" diff --git a/conans/test/functional/command/install/install_update_test.py b/conans/test/functional/command/install/install_update_test.py index b0f799b2dcb..f09dc4e39c8 100644 --- a/conans/test/functional/command/install/install_update_test.py +++ b/conans/test/functional/command/install/install_update_test.py @@ -4,6 +4,8 @@ from collections import OrderedDict from time import sleep +import pytest + from conans.model.ref import ConanFileReference, PackageReference from conans.paths import CONAN_MANIFEST from conans.test.assets.cpp_test_files import cpp_hello_conan_files @@ -153,6 +155,7 @@ class Pkg(ConanFile): self.assertIn("Pkg/0.1@lasote/testing: WARN: Can't update, no package in remote", client.out) + @pytest.mark.tool_compiler def test_update_not_date(self): # Regression for https://github.com/conan-io/conan/issues/949 files0 = cpp_hello_conan_files("Hello0", "1.0", build=False) @@ -228,7 +231,7 @@ def timestamps(): self.assertEqual(update_timestamps, initial_timestamps) def test_reuse(self): - files = cpp_hello_conan_files("Hello0", "1.0", build=False) + files = cpp_hello_conan_files("Hello0", "1.0", build=False, settings='"os"') self.client.save(files) self.client.run("export . lasote/stable") diff --git a/conans/test/functional/command/package_test.py b/conans/test/functional/command/package_test.py index 0f5495a8fc3..a272c1d708b 100644 --- a/conans/test/functional/command/package_test.py +++ b/conans/test/functional/command/package_test.py @@ -1,6 +1,7 @@ import os import unittest +import pytest from parameterized import parameterized from conans.client import tools @@ -29,6 +30,7 @@ def package(self): client.run("package .") self.assertIn("Test_param: hello-world!", client.out) + @pytest.mark.tool_compiler def test_package_with_destination(self): client = TestClient() diff --git a/conans/test/functional/command/source_test.py b/conans/test/functional/command/source_test.py index 81f109feb65..659485ef756 100644 --- a/conans/test/functional/command/source_test.py +++ b/conans/test/functional/command/source_test.py @@ -1,6 +1,7 @@ import os import unittest +import pytest import six from conans.paths import BUILD_INFO, CONANFILE @@ -10,6 +11,7 @@ class SourceTest(unittest.TestCase): + @pytest.mark.tool_git def test_conanfile_removed(self): # https://github.com/conan-io/conan/issues/4013 conanfile = """from conans import ConanFile diff --git a/conans/test/functional/command/test_command_test.py b/conans/test/functional/command/test_command_test.py index b524eca6a68..46a9cd249f2 100644 --- a/conans/test/functional/command/test_command_test.py +++ b/conans/test/functional/command/test_command_test.py @@ -127,6 +127,7 @@ def test(self): self.assertEqual("Bye FindCmake", load(os.path.join(client.cache.package_layout(pref.ref).package(pref), "FindXXX.cmake"))) + @pytest.mark.tool_cmake def test_conan_test(self): conanfile = ''' from conans import ConanFile, CMake diff --git a/conans/test/functional/command/upload/syncronize_test.py b/conans/test/functional/command/upload/syncronize_test.py index 44648519959..b0426e3f3ab 100644 --- a/conans/test/functional/command/upload/syncronize_test.py +++ b/conans/test/functional/command/upload/syncronize_test.py @@ -2,6 +2,8 @@ import shutil import unittest +import pytest + from conans import DEFAULT_REVISION_V1 from conans.client.tools.files import untargz from conans.model.manifest import FileTreeManifest @@ -15,6 +17,7 @@ class SynchronizeTest(unittest.TestCase): + @pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected def test_upload(self): client = TestClient(servers={"default": TestServer()}, users={"default": [("lasote", "mypass")]}) diff --git a/conans/test/functional/command/upload/upload_complete_test.py b/conans/test/functional/command/upload/upload_complete_test.py index e31b83986e0..227c9f90e6a 100644 --- a/conans/test/functional/command/upload/upload_complete_test.py +++ b/conans/test/functional/command/upload/upload_complete_test.py @@ -5,6 +5,7 @@ import textwrap import unittest +import pytest import six from mock import patch from requests.packages.urllib3.exceptions import ConnectionError @@ -132,6 +133,7 @@ def setUp(self): self.assertFalse(os.path.exists(self.server_reg_folder)) self.assertFalse(os.path.exists(self.server_pack_folder)) + @pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected def test_try_upload_bad_recipe(self): files = cpp_hello_conan_files("Hello0", "1.2.1") self.client.save(files) @@ -143,6 +145,7 @@ def test_try_upload_bad_recipe(self): self.assertIn("Cannot upload corrupted recipe", self.client.out) + @pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected def test_upload_with_pattern(self): for num in range(5): files = cpp_hello_conan_files("Hello%s" % num, "1.2.1") @@ -161,6 +164,7 @@ def test_upload_with_pattern(self): self.assertNotIn("Hello2", self.client.out) self.assertNotIn("Hello3", self.client.out) + @pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected def test_upload_error(self): """Cause an error in the transfer and see some message""" @@ -213,6 +217,7 @@ def test_upload_error(self): client.run("upload Hello* --confirm --retry 3 --retry-wait=0 --all") self.assertEqual(str(client.out).count("ERROR: Pair file, error!"), 6) + @pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected def test_upload_error_with_config(self): """Cause an error in the transfer and see some message""" @@ -342,6 +347,7 @@ def test_upload_with_pattern_and_package_error(self): self.assertIn("-p parameter only allowed with a valid recipe reference", self.client.out) + @pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected def test_check_upload_confirm_question(self): user_io = MockedUserIO({"default": [("lasote", "mypass")]}, out=TestBufferConanOutput()) files = cpp_hello_conan_files("Hello1", "1.2.1") diff --git a/conans/test/functional/command/upload/upload_compression_test.py b/conans/test/functional/command/upload/upload_compression_test.py index bb49ea558e9..eaf53a1c718 100644 --- a/conans/test/functional/command/upload/upload_compression_test.py +++ b/conans/test/functional/command/upload/upload_compression_test.py @@ -1,12 +1,14 @@ import os import unittest +import pytest + from conans.model.ref import ConanFileReference, PackageReference from conans.test.assets.cpp_test_files import cpp_hello_conan_files from conans.test.utils.test_files import uncompress_packaged_files from conans.test.utils.tools import TestClient, TestServer - +@pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected class UploadCompressionTest(unittest.TestCase): def setUp(self): diff --git a/conans/test/functional/command/upload/upload_test.py b/conans/test/functional/command/upload/upload_test.py index dbd61e50970..5bff9849d26 100644 --- a/conans/test/functional/command/upload/upload_test.py +++ b/conans/test/functional/command/upload/upload_test.py @@ -330,6 +330,7 @@ def test_upload_modified_recipe(self): client.run("upload Hello0/1.2.1@frodo/stable") self.assertIn("Recipe is up to date, upload skipped", client.out) + @pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected def test_upload_unmodified_recipe(self): client = self._client() @@ -546,6 +547,7 @@ def package(self): else: self.assertIn("Uploading conan_package.tgz", client.out) + @pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected def test_skip_upload(self): """ Check that the option --dry does not upload anything """ @@ -599,6 +601,7 @@ def test_upload_without_sources(self): self.assertIn("Uploading conanfile.py", client2.out) self.assertIn("Uploading conan_package.tgz", client2.out) + @pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected def test_upload_login_prompt_disabled_no_user(self): """ Without user info, uploads should fail when login prompt has been disabled. """ @@ -616,6 +619,7 @@ def test_upload_login_prompt_disabled_no_user(self): self.assertNotIn("Uploading conanfile.py", client.out) self.assertNotIn("Uploading conan_export.tgz", client.out) + @pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected def test_upload_login_prompt_disabled_user_not_authenticated(self): # When a user is not authenticated, uploads should fail when login prompt has been disabled. files = cpp_hello_conan_files("Hello0", "1.2.1", build=False) @@ -633,6 +637,7 @@ def test_upload_login_prompt_disabled_user_not_authenticated(self): self.assertNotIn("Uploading conan_export.tgz", client.out) self.assertNotIn("Please enter a password for \"lasote\" account:", client.out) + @pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected def test_upload_login_prompt_disabled_user_authenticated(self): # When user is authenticated, uploads should work even when login prompt has been disabled. files = cpp_hello_conan_files("Hello0", "1.2.1", build=False) @@ -648,6 +653,7 @@ def test_upload_login_prompt_disabled_user_authenticated(self): self.assertIn("Uploading conan_export.tgz", client.out) @unittest.skipUnless(get_env("TESTING_REVISIONS_ENABLED", False), "Only revisions") + @pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected def test_upload_key_error(self): files = cpp_hello_conan_files("Hello0", "1.2.1", build=False) server1 = TestServer([("*/*@*/*", "*")], [("*/*@*/*", "*")], users={"lasote": "mypass"}) @@ -799,6 +805,7 @@ def test_checksums_metadata(self): self.assertEqual(metadata.recipe.checksums["conanfile.py"]["md5"], recipe_md5) self.assertEqual(metadata.recipe.checksums["conanfile.py"]["sha1"], recipe_sha1) + @pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected def test_upload_without_cleaned_user(self): """ When a user is not authenticated, uploads failed first time https://github.com/conan-io/conan/issues/5878 diff --git a/conans/test/functional/conan_build_info/test_build_info_creation.py b/conans/test/functional/conan_build_info/test_build_info_creation.py index 4958d7d3994..9cdcb4be698 100644 --- a/conans/test/functional/conan_build_info/test_build_info_creation.py +++ b/conans/test/functional/conan_build_info/test_build_info_creation.py @@ -4,6 +4,7 @@ import textwrap import unittest +import pytest from mock import patch, Mock from six import StringIO @@ -185,6 +186,7 @@ def test_build_info_create_update_publish(self, mock_cache, user_home_mock): for user_channel in user_channels: self._test_buildinfo(client, user_channel) + @pytest.mark.tool_git @patch("conans.build_info.build_info.get_conan_user_home") @patch("conans.build_info.build_info.ClientCache") @patch("conans.build_info.build_info.requests.get", new=mock_response_get) diff --git a/conans/test/functional/conan_build_info/test_build_info_extraction.py b/conans/test/functional/conan_build_info/test_build_info_extraction.py index d573165a11b..23eeb1aed6e 100644 --- a/conans/test/functional/conan_build_info/test_build_info_extraction.py +++ b/conans/test/functional/conan_build_info/test_build_info_extraction.py @@ -16,6 +16,7 @@ from conans.util.files import load, save +@pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected class MyBuildInfo(unittest.TestCase): def setUp(self): diff --git a/conans/test/functional/conanfile/exception_printing_test.py b/conans/test/functional/conanfile/exception_printing_test.py index ef078fb1202..b71ce7401e1 100644 --- a/conans/test/functional/conanfile/exception_printing_test.py +++ b/conans/test/functional/conanfile/exception_printing_test.py @@ -1,10 +1,13 @@ import unittest +import pytest + from conans.client import tools from conans.paths import CONANFILE from conans.test.utils.tools import TestClient +@pytest.mark.tool_compiler class ExceptionPrintingTest(unittest.TestCase): conanfile = """ import os diff --git a/conans/test/functional/conanfile/runner_test.py b/conans/test/functional/conanfile/runner_test.py index 6c0f08eaf48..4c52fdfdc79 100644 --- a/conans/test/functional/conanfile/runner_test.py +++ b/conans/test/functional/conanfile/runner_test.py @@ -3,6 +3,7 @@ import textwrap import unittest +import pytest import six from conans.client.runner import ConanRunner @@ -62,6 +63,7 @@ def test_write_to_stringio(self): > python --version -----------------""", out.getvalue()) + @pytest.mark.tool_cmake def test_log(self): conanfile = ''' from conans import ConanFile diff --git a/conans/test/functional/configuration/conan_trace_file_test.py b/conans/test/functional/configuration/conan_trace_file_test.py index ed4144a58c1..72377192f51 100644 --- a/conans/test/functional/configuration/conan_trace_file_test.py +++ b/conans/test/functional/configuration/conan_trace_file_test.py @@ -2,6 +2,8 @@ import os import unittest +import pytest + from conans.client import tools from conans.client.runner import ConanRunner from conans.model.ref import ConanFileReference @@ -71,6 +73,7 @@ def _install_a_package(print_commands_to_output, generate_run_log_file): self.assertNotIn("Packaged 1 '.log' file: conan_run.log", output) self.assertFalse(os.path.exists(log_file_packaged)) + @pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected def test_trace_actions(self): client = TestClient(servers=self.servers, users={"default": [("lasote", "mypass")]}) diff --git a/conans/test/functional/configuration/profile_test.py b/conans/test/functional/configuration/profile_test.py index 59c818d604b..3811d79732a 100644 --- a/conans/test/functional/configuration/profile_test.py +++ b/conans/test/functional/configuration/profile_test.py @@ -4,6 +4,7 @@ from collections import OrderedDict from textwrap import dedent +import pytest from parameterized import parameterized from conans.client import tools @@ -70,6 +71,7 @@ def test_profile_relative_cwd(self): self.client.run("install .. -pr=sub/profile") self.assertIn("conanfile.txt: Installing package", self.client.out) + @pytest.mark.tool_compiler def test_base_profile_generated(self): """we are testing that the default profile is created (when not existing, fresh install) even when you run a create with a profile""" @@ -77,6 +79,7 @@ def test_base_profile_generated(self): "myprofile": "include(default)\n[settings]\nbuild_type=Debug"}) self.client.run("create . conan/testing --profile myprofile") + @pytest.mark.tool_compiler def test_bad_syntax(self): self.client.save({CONANFILE: conanfile_scope_env}) self.client.run("export . lasote/stable") @@ -151,13 +154,18 @@ def test_bad_syntax(self): self.client.run("install Hello0/0.1@lasote/stable --build -pr clang") self._assert_env_variable_printed("ENV_VAR", "a value") - @parameterized.expand([("", ), ("./local_profiles/", ), (temp_folder() + "/", )]) + @parameterized.expand([("", ), ("./local_profiles/", ), (None, )]) def test_install_with_missing_profile(self, path): + if path is None: + # Not good practice to introduce temp_folder() in the expand because it randomize + # the test names causing issues to split them in N processes + path = temp_folder() + "/" self.client.save({CONANFILE: conanfile_scope_env}) self.client.run('install . -pr "%sscopes_env"' % path, assert_error=True) self.assertIn("ERROR: Profile not found:", self.client.out) self.assertIn("scopes_env", self.client.out) + @pytest.mark.tool_compiler def test_install_profile_env(self): files = cpp_hello_conan_files("Hello0", "0.1", build=False) files["conanfile.py"] = conanfile_scope_env @@ -306,6 +314,7 @@ def test_install_profile_package_settings(self): self.assertNotIn("gcc", info) self.assertNotIn("libcxx", info) + @pytest.mark.tool_compiler def test_install_profile_options(self): files = cpp_hello_conan_files("Hello0", "0.1", build=False) @@ -319,6 +328,7 @@ def test_install_profile_options(self): self.assertIn("language=1", info) self.assertIn("static=False", info) + @pytest.mark.tool_compiler def test_scopes_env(self): # Create a profile and use it create_profile(self.client.cache.profiles_path, "scopes_env", settings={}, @@ -334,6 +344,7 @@ def test_scopes_env(self): self.assertFalse(os.environ.get("CC", None) == "/path/tomy/gcc") self.assertFalse(os.environ.get("CXX", None) == "/path/tomy/g++") + @pytest.mark.tool_compiler def test_default_including_another_profile(self): p1 = "include(p2)\n[env]\nA_VAR=1" p2 = "include(default)\n[env]\nA_VAR=2" @@ -350,6 +361,7 @@ def test_default_including_another_profile(self): self.client.run("create . user/testing") self._assert_env_variable_printed("A_VAR", "1") + @pytest.mark.tool_compiler def test_test_package(self): test_conanfile = '''from conans.model.conan_file import ConanFile from conans import CMake @@ -409,6 +421,7 @@ def test(self): def _assert_env_variable_printed(self, name, value): self.assertIn("%s=%s" % (name, value), self.client.out) + @pytest.mark.tool_compiler def test_info_with_profiles(self): self.client.run("remove '*' -f") diff --git a/conans/test/functional/editable/consume_header_only_test.py b/conans/test/functional/editable/consume_header_only_test.py index 1321922e8b8..032e3c5be33 100644 --- a/conans/test/functional/editable/consume_header_only_test.py +++ b/conans/test/functional/editable/consume_header_only_test.py @@ -4,6 +4,7 @@ import textwrap import unittest +import pytest from parameterized import parameterized from conans.model.editable_layout import DEFAULT_LAYOUT_FILE, LAYOUTS_FOLDER @@ -12,6 +13,7 @@ from conans.test.utils.test_files import temp_folder +@pytest.mark.tool_cmake class HeaderOnlyLibTestClient(TestClient): header = textwrap.dedent("""\ #include @@ -80,7 +82,7 @@ def update_hello_word(self, hello_word): "src/include-local/hello.hpp": self.header.format(word=hello_word, origin='local')}) - +@pytest.mark.tool_cmake class EditableReferenceTest(unittest.TestCase): @parameterized.expand([(False, True), (True, False), (True, True), (False, False)]) diff --git a/conans/test/functional/editable/consume_settings_and_options_test.py b/conans/test/functional/editable/consume_settings_and_options_test.py index 692dafef7d3..45be8f185bc 100644 --- a/conans/test/functional/editable/consume_settings_and_options_test.py +++ b/conans/test/functional/editable/consume_settings_and_options_test.py @@ -4,6 +4,7 @@ import os import unittest +import pytest from parameterized import parameterized from conans.model.editable_layout import DEFAULT_LAYOUT_FILE, LAYOUTS_FOLDER @@ -76,6 +77,7 @@ def __init__(self, use_repo_file, *args, **kwargs): self.save(files) +@pytest.mark.tool_cmake class SettingsAndOptionsTest(unittest.TestCase): @parameterized.expand(itertools.product(["Debug", "Release", ], # build_type diff --git a/conans/test/functional/environment/apply_environment_test.py b/conans/test/functional/environment/apply_environment_test.py index cbbd7f07521..f34949f250f 100644 --- a/conans/test/functional/environment/apply_environment_test.py +++ b/conans/test/functional/environment/apply_environment_test.py @@ -19,6 +19,7 @@ class ConanEnvTest(unittest.TestCase): @attr('slow') @pytest.mark.slow + @pytest.mark.tool_cmake def test_shared_in_current_directory(self): """ - There is a package building a shared library diff --git a/conans/test/functional/environment/build_environment_test.py b/conans/test/functional/environment/build_environment_test.py index 8a53331028d..58b98871670 100644 --- a/conans/test/functional/environment/build_environment_test.py +++ b/conans/test/functional/environment/build_environment_test.py @@ -2,6 +2,8 @@ import unittest from textwrap import dedent +import pytest + from conans.paths import CONANFILE from conans.test.utils.tools import TestClient from conans.test.assets.cpp_test_files import cpp_hello_conan_files @@ -63,6 +65,7 @@ def package_info(self): class BuildEnvironmenTest(unittest.TestCase): @unittest.skipUnless(platform.system() == "Linux", "Requires Linux") + @pytest.mark.tool_autotools def test_use_build_virtualenv(self): client = TestClient(path_with_spaces=False) client.save({CONANFILE: conanfile, "mean.cpp": mylib, "mean.h": mylibh}) diff --git a/conans/test/functional/environment/run_environment_test.py b/conans/test/functional/environment/run_environment_test.py index e1783236661..841d2fb6d56 100644 --- a/conans/test/functional/environment/run_environment_test.py +++ b/conans/test/functional/environment/run_environment_test.py @@ -4,6 +4,8 @@ import textwrap import unittest +import pytest + from conans.client import tools from conans.paths import CONANFILE from conans.test.assets.cpp_test_files import cpp_hello_conan_files @@ -11,6 +13,7 @@ from conans.util.runners import check_output_runner +@pytest.mark.tool_cmake class RunEnvironmentTest(unittest.TestCase): def test_run_environment(self): @@ -44,6 +47,7 @@ def build(self): self.assertIn("Hello Hello0", client.out) +@pytest.mark.tool_cmake class RunEnvironmentSharedTest(unittest.TestCase): def setUp(self): diff --git a/conans/test/functional/generators/cmake_components_test.py b/conans/test/functional/generators/cmake_components_test.py index 5efc70bcf31..2014ca40268 100644 --- a/conans/test/functional/generators/cmake_components_test.py +++ b/conans/test/functional/generators/cmake_components_test.py @@ -11,6 +11,7 @@ @attr('slow') @pytest.mark.slow +@pytest.mark.tool_cmake class CMakeGeneratorsWithComponentsTest(unittest.TestCase): @staticmethod diff --git a/conans/test/functional/generators/cmake_find_package_multi_test.py b/conans/test/functional/generators/cmake_find_package_multi_test.py index f6164825131..ed1b2dcac9f 100644 --- a/conans/test/functional/generators/cmake_find_package_multi_test.py +++ b/conans/test/functional/generators/cmake_find_package_multi_test.py @@ -14,6 +14,7 @@ @attr('slow') @pytest.mark.slow +@pytest.mark.tool_cmake class CMakeFindPathMultiGeneratorTest(unittest.TestCase): def test_native_export_multi(self): diff --git a/conans/test/functional/generators/cmake_find_package_test.py b/conans/test/functional/generators/cmake_find_package_test.py index 9524dea947d..ffe16ed8c05 100644 --- a/conans/test/functional/generators/cmake_find_package_test.py +++ b/conans/test/functional/generators/cmake_find_package_test.py @@ -16,6 +16,7 @@ @attr('slow') @pytest.mark.slow +@pytest.mark.tool_cmake class CMakeFindPathGeneratorTest(unittest.TestCase): def test_cmake_find_package_system_libs(self): diff --git a/conans/test/functional/generators/cmake_generator_test.py b/conans/test/functional/generators/cmake_generator_test.py index a4f5146bcc0..084136a3ea3 100644 --- a/conans/test/functional/generators/cmake_generator_test.py +++ b/conans/test/functional/generators/cmake_generator_test.py @@ -1,6 +1,8 @@ import os import unittest +import pytest + from conans import tools from conans.client.runner import ConanRunner from conans.test.utils.tools import TestClient @@ -40,6 +42,7 @@ def build(self): """ +@pytest.mark.tool_cmake class CMakeGeneratorTest(unittest.TestCase): def _check_build_generator(self, os_build, generator): diff --git a/conans/test/functional/generators/cmake_multi_test.py b/conans/test/functional/generators/cmake_multi_test.py index 2ea1a9e12b8..b1fd2eb1456 100644 --- a/conans/test/functional/generators/cmake_multi_test.py +++ b/conans/test/functional/generators/cmake_multi_test.py @@ -6,7 +6,8 @@ import pytest from nose.plugins.attrib import attr -from conans.client.tools import remove_from_path + +from conans.client.tools import remove_from_path, no_op from conans.test.assets.multi_config import multi_config_files from conans.test.utils.tools import TestClient @@ -134,10 +135,11 @@ def package_files(name, deps=None): @attr("slow") @pytest.mark.slow +@pytest.mark.tool_cmake class CMakeMultiTest(unittest.TestCase): @attr("mingw") - @pytest.mark.tool_mingw + @pytest.mark.tool_gcc def test_cmake_multi_find(self): if platform.system() not in ["Windows", "Linux"]: return @@ -181,7 +183,8 @@ class HelloConan(ConanFile): client.run("install . -s build_type=RelWithDebInfo --build=missing ") client.run("install . -s build_type=MinSizeRel --build=missing ") - with remove_from_path("sh"): + # in Linux it can remove /usr/bin from the path invalidating "cmake" and everything + with remove_from_path("sh") if platform.system() == "Windows" else no_op(): generator = "MinGW Makefiles" if platform.system() == "Windows" else "Unix Makefiles" client.run_command('cmake . -G "%s" -DCMAKE_BUILD_TYPE=Debug' % generator) self.assertIn("FIND HELLO DEBUG!", client.out) @@ -275,6 +278,7 @@ def test_cmake_multi(self): self.assertIn("Hello Release Hello0", client.out) +@pytest.mark.tool_cmake class CMakeMultiSystemLibsTest(unittest.TestCase): def test_system_libs(self): @@ -329,6 +333,7 @@ class Consumer(ConanFile): self.assertIn("set(CONAN_SYSTEM_LIBS_MYLIB_DEBUG sys1d)", content) +@pytest.mark.tool_cmake class CMakeMultiSyntaxTest(unittest.TestCase): def setUp(self): diff --git a/conans/test/functional/generators/cmake_paths_test.py b/conans/test/functional/generators/cmake_paths_test.py index 571bb4e75d4..80cbb04868e 100644 --- a/conans/test/functional/generators/cmake_paths_test.py +++ b/conans/test/functional/generators/cmake_paths_test.py @@ -3,10 +3,13 @@ import shutil import unittest +import pytest + from conans.model.ref import ConanFileReference, PackageReference from conans.test.utils.tools import TestClient, NO_SETTINGS_PACKAGE_ID, TurboTestClient, GenConanfile +@pytest.mark.tool_cmake class CMakePathsGeneratorTest(unittest.TestCase): def test_cmake_paths_contents(self): diff --git a/conans/test/functional/generators/cmake_skip_rpath_test.py b/conans/test/functional/generators/cmake_skip_rpath_test.py index d7a6de27636..f2bbf07e300 100644 --- a/conans/test/functional/generators/cmake_skip_rpath_test.py +++ b/conans/test/functional/generators/cmake_skip_rpath_test.py @@ -1,6 +1,8 @@ import platform import unittest +import pytest + from conans.test.utils.tools import TestClient conanfile_py = """ @@ -30,6 +32,7 @@ class HelloConan(ConanFile): """ +@pytest.mark.tool_cmake class CMakeSkipRpathTest(unittest.TestCase): def test_skip_flag(self): diff --git a/conans/test/functional/generators/cmake_test.py b/conans/test/functional/generators/cmake_test.py index 4aa93c44e8a..9c4854b617e 100644 --- a/conans/test/functional/generators/cmake_test.py +++ b/conans/test/functional/generators/cmake_test.py @@ -11,6 +11,7 @@ from conans.test.utils.tools import TestClient, GenConanfile, TurboTestClient +@pytest.mark.tool_cmake class CMakeGeneratorTest(unittest.TestCase): def test_no_check_compiler(self): diff --git a/conans/test/functional/generators/components/cmake_find_package_multi_test.py b/conans/test/functional/generators/components/cmake_find_package_multi_test.py index 0cdcc529112..7ff0fa00bdc 100644 --- a/conans/test/functional/generators/components/cmake_find_package_multi_test.py +++ b/conans/test/functional/generators/components/cmake_find_package_multi_test.py @@ -13,6 +13,7 @@ @attr('slow') @pytest.mark.slow +@pytest.mark.tool_cmake class CMakeGeneratorsWithComponentsTest(unittest.TestCase): @staticmethod diff --git a/conans/test/functional/generators/components/pkg_config_test.py b/conans/test/functional/generators/components/pkg_config_test.py index ca44892557c..e848bd6fc99 100644 --- a/conans/test/functional/generators/components/pkg_config_test.py +++ b/conans/test/functional/generators/components/pkg_config_test.py @@ -2,12 +2,15 @@ import textwrap import unittest +import pytest + from conans.client.tools import PkgConfig, environment_append from conans.model.ref import ConanFileReference from conans.test.assets.genconanfile import GenConanfile from conans.test.utils.tools import TestClient +@pytest.mark.tool_compiler class PkgConfigGeneratorWithComponentsTest(unittest.TestCase): @staticmethod diff --git a/conans/test/functional/generators/custom_generator_test.py b/conans/test/functional/generators/custom_generator_test.py index a2d981ff5f7..cd8f62827e3 100644 --- a/conans/test/functional/generators/custom_generator_test.py +++ b/conans/test/functional/generators/custom_generator_test.py @@ -1,6 +1,8 @@ import textwrap import unittest +import pytest + from conans.model.ref import ConanFileReference from conans.paths import CONANFILE, CONANFILE_TXT from conans.test.assets.cpp_test_files import cpp_hello_conan_files @@ -71,6 +73,7 @@ def setUp(self): test_server = TestServer() self.servers = {"default": test_server} + @pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected def test_reuse(self): ref = ConanFileReference.loads("Hello0/0.1@lasote/stable") files = cpp_hello_conan_files("Hello0", "0.1", build=False) diff --git a/conans/test/functional/generators/link_order_test.py b/conans/test/functional/generators/link_order_test.py index 1d15093a89a..e4a685ab7c3 100644 --- a/conans/test/functional/generators/link_order_test.py +++ b/conans/test/functional/generators/link_order_test.py @@ -3,6 +3,7 @@ import textwrap import unittest +import pytest from jinja2 import Template from parameterized import parameterized @@ -10,6 +11,7 @@ from conans.test.utils.tools import TestClient +@pytest.mark.tool_cmake class LinkOrderTest(unittest.TestCase): """ Check that the link order of libraries is preserved when using CMake generators https://github.com/conan-io/conan/issues/6280 diff --git a/conans/test/functional/generators/make_test.py b/conans/test/functional/generators/make_test.py index eb7fb3ef860..f4ad706b2c5 100644 --- a/conans/test/functional/generators/make_test.py +++ b/conans/test/functional/generators/make_test.py @@ -13,6 +13,7 @@ class MakeGeneratorTest(unittest.TestCase): @attr('slow') @pytest.mark.slow + @pytest.mark.tool_autotools @unittest.skipUnless(platform.system() == "Linux", "Requires make") def test_complete_creation_reuse(self): client = TestClient(path_with_spaces=False) diff --git a/conans/test/functional/generators/pkg_config_test.py b/conans/test/functional/generators/pkg_config_test.py index 4b0bbfde1b9..ca79d291267 100644 --- a/conans/test/functional/generators/pkg_config_test.py +++ b/conans/test/functional/generators/pkg_config_test.py @@ -3,6 +3,8 @@ import textwrap import unittest +import pytest + from conans.test.assets.genconanfile import GenConanfile from conans.test.utils.tools import TestClient from conans.util.files import load @@ -10,6 +12,8 @@ class PkgGeneratorTest(unittest.TestCase): + # Without compiler, def rpath_flags(settings, os_build, lib_paths): doesn't append the -Wl...etc + @pytest.mark.tool_compiler def test_pkg_config_dirs(self): # https://github.com/conan-io/conan/issues/2756 conanfile = """ diff --git a/conans/test/functional/generators/qbs_test.py b/conans/test/functional/generators/qbs_test.py index d4abda55069..52cf9b00b7a 100644 --- a/conans/test/functional/generators/qbs_test.py +++ b/conans/test/functional/generators/qbs_test.py @@ -1,9 +1,12 @@ import unittest +import pytest + from conans.test.assets.genconanfile import GenConanfile from conans.test.utils.tools import TestClient +@pytest.mark.tool_compiler class QbsGeneratorTest(unittest.TestCase): def test(self): diff --git a/conans/test/functional/generators/virtualbuildenv_test.py b/conans/test/functional/generators/virtualbuildenv_test.py index 1a5f06d9037..55dc6389232 100644 --- a/conans/test/functional/generators/virtualbuildenv_test.py +++ b/conans/test/functional/generators/virtualbuildenv_test.py @@ -3,6 +3,8 @@ import textwrap import unittest +import pytest + from conans.test.utils.tools import TestClient from conans.util.runners import check_output_runner @@ -24,6 +26,7 @@ class TestConan(ConanFile): self.assertIn("UseEnv=True", bat) self.assertIn('CL=-MD -DNDEBUG -O2 -Ob2 %CL%', bat) + @pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected def test_environment_deactivate(self): if platform.system() == "Windows": """ This test fails. The deactivation script takes the value of some envvars set by diff --git a/conans/test/functional/generators/virtualenv_test.py b/conans/test/functional/generators/virtualenv_test.py index 52d006b8dac..7953f755984 100644 --- a/conans/test/functional/generators/virtualenv_test.py +++ b/conans/test/functional/generators/virtualenv_test.py @@ -183,11 +183,14 @@ def _run_virtualenv(self, generator): env_before = _load_env_file(os.path.join(self.test_folder, self.env_before)) env_after = _load_env_file(os.path.join(self.test_folder, self.env_after)) - if platform.system() == "Darwin": + there_was_ps1 = os.getenv("PS1") + # FIXME: Not the best behavior + # The deactivate sets PS1 always, but sometimes it didn't exist previously + if platform.system() == "Darwin" or not there_was_ps1: env_after.pop(six.u("PS1"), None) # TODO: FIXME: Needed for the test to pass env_after.pop("PS1", None) # TODO: FIXME: Needed for the test to pass - self.assertDictEqual(env_before, env_after) # Environment restored correctly + self.assertDictEqual(env_before, env_after) # Environment restored correctly return stdout, _load_env_file(os.path.join(self.test_folder, self.env_activated)) def test_basic_variable(self): diff --git a/conans/test/functional/generators/visual_studio_test.py b/conans/test/functional/generators/visual_studio_test.py index 676484e9581..197faa90d30 100644 --- a/conans/test/functional/generators/visual_studio_test.py +++ b/conans/test/functional/generators/visual_studio_test.py @@ -94,6 +94,7 @@ def build(self): client.run_command(r"x64\Release\MyProject.exe") self.assertIn("Hello world!!!", client.out) + @pytest.mark.tool_compiler def test_system_libs(self): mylib = textwrap.dedent(""" import os diff --git a/conans/test/functional/graph/diamond_test.py b/conans/test/functional/graph/diamond_test.py index 30ef870fc5c..d647ca01178 100644 --- a/conans/test/functional/graph/diamond_test.py +++ b/conans/test/functional/graph/diamond_test.py @@ -14,6 +14,7 @@ @attr("slow") @pytest.mark.slow +@pytest.mark.tool_compiler class DiamondTest(unittest.TestCase): def setUp(self): diff --git a/conans/test/functional/graph/private_deps_test.py b/conans/test/functional/graph/private_deps_test.py index 7a626861481..b05988c3983 100644 --- a/conans/test/functional/graph/private_deps_test.py +++ b/conans/test/functional/graph/private_deps_test.py @@ -200,6 +200,7 @@ def test_private_dont_skip(self): @attr("slow") @pytest.mark.slow +@pytest.mark.tool_cmake class PrivateDepsTest(unittest.TestCase): def setUp(self): diff --git a/conans/test/functional/only_source_test.py b/conans/test/functional/only_source_test.py index 068129d06b8..f330bf241f8 100644 --- a/conans/test/functional/only_source_test.py +++ b/conans/test/functional/only_source_test.py @@ -1,6 +1,8 @@ import os import unittest +import pytest + from conans.model.ref import ConanFileReference from conans.paths import CONANFILE from conans.test.assets.cpp_test_files import cpp_hello_conan_files @@ -21,6 +23,7 @@ def _create(self, client, number, version, deps=None, export=True): if export: client.run("export . lasote/stable") + @pytest.mark.tool_cmake def test_conan_test(self): # Checks --build in test command client = TestClient() @@ -89,6 +92,7 @@ def package(self): client.out) client.run("upload test/1.9@lasote/stable") + @pytest.mark.tool_cmake def test_build_policies_in_conanfile(self): client = TestClient(servers=self.servers, users={"default": [("lasote", "mypass")]}) @@ -137,6 +141,7 @@ def test_build_policies_in_conanfile(self): client.run("upload Hello0/1.0@lasote/stable --all", assert_error=True) self.assertIn("no packages can be uploaded", client.out) + @pytest.mark.tool_cmake def test_reuse(self): client = TestClient(servers=self.servers, users={"default": [("lasote", "mypass")]}) ref = ConanFileReference.loads("Hello0/0.1@lasote/stable") diff --git a/conans/test/functional/package_id/package_id_test.py b/conans/test/functional/package_id/package_id_test.py index 1650eef8b97..529edb9444e 100644 --- a/conans/test/functional/package_id/package_id_test.py +++ b/conans/test/functional/package_id/package_id_test.py @@ -1,6 +1,8 @@ import textwrap import unittest +import pytest + from conans.test.utils.tools import NO_SETTINGS_PACKAGE_ID, TestClient, TestServer @@ -49,6 +51,7 @@ def package_id(self): "'%s' created" % NO_SETTINGS_PACKAGE_ID, client.out) + @pytest.mark.tool_compiler def test_value_parse(self): # https://github.com/conan-io/conan/issues/2816 conanfile = """ diff --git a/conans/test/functional/py_requires/python_requires_test.py b/conans/test/functional/py_requires/python_requires_test.py index 97c7492f5de..ab46a9910bb 100644 --- a/conans/test/functional/py_requires/python_requires_test.py +++ b/conans/test/functional/py_requires/python_requires_test.py @@ -4,6 +4,7 @@ import time import unittest +import pytest from parameterized import parameterized from conans.model.ref import ConanFileReference @@ -282,6 +283,7 @@ class PkgTest(ConanFile): self.assertIn("Pkg/0.1@user/testing: Package installed " "69265e58ddc68274e0c5510905003ff78c9db5de", client.out) + @pytest.mark.tool_git def test_reuse_scm(self): client = TestClient() conanfile = textwrap.dedent(""" @@ -311,6 +313,7 @@ class PkgTest(ConanFile): self.assertIn('"type": "git",', client.out) self.assertIn('"url": "somerepo"', client.out) + @pytest.mark.tool_git def test_reuse_customize_scm(self): client = TestClient() conanfile = textwrap.dedent(""" @@ -346,6 +349,7 @@ def init(self): self.assertIn('"type": "git",', client.out) self.assertIn('"url": "other_repo"', client.out) + @pytest.mark.tool_git def test_reuse_scm_multiple_conandata(self): # https://github.com/conan-io/conan/issues/7236 # This only works when using conandata.yml, conanfile.py replace is broken @@ -499,6 +503,7 @@ def build(self): self.assertIn("Pkg/0.1@user/testing: Author! frodo", client.out) self.assertIn("Pkg/0.1@user/testing: os: Windows arch: armv7", client.out) + @pytest.mark.tool_compiler def test_failure_init_method(self): client = TestClient() base = textwrap.dedent(""" diff --git a/conans/test/functional/python_requires/python_requires_test.py b/conans/test/functional/python_requires/python_requires_test.py index 534a90d5973..e4d9438e01d 100644 --- a/conans/test/functional/python_requires/python_requires_test.py +++ b/conans/test/functional/python_requires/python_requires_test.py @@ -3,6 +3,7 @@ import time import unittest +import pytest from parameterized import parameterized from conans.model.ref import ConanFileReference @@ -345,6 +346,7 @@ class PkgTest(base.MyConanfileBase): self.assertIn("Pkg/0.1@lasote/testing: Package installed %s" % NO_SETTINGS_PACKAGE_ID, client.out) + @pytest.mark.tool_git def test_reuse_scm(self): client = TestClient() diff --git a/conans/test/functional/remote/multi_remote_test.py b/conans/test/functional/remote/multi_remote_test.py index 2fe99ab7b13..31496ead872 100644 --- a/conans/test/functional/remote/multi_remote_test.py +++ b/conans/test/functional/remote/multi_remote_test.py @@ -4,6 +4,8 @@ from collections import OrderedDict from time import sleep +import pytest + from conans.model.ref import ConanFileReference from conans.paths import CONANFILE from conans.test.assets.cpp_test_files import cpp_hello_conan_files @@ -50,7 +52,7 @@ class Pkg(ConanFile): self.assertIn("Probably it was installed from a remote that is no longer available.", client2.out) - +@pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected class MultiRemotesTest(unittest.TestCase): def setUp(self): @@ -173,7 +175,7 @@ def test_conan_install_update(self): client.run("install Hello0/0.0@lasote/stable --update") self.assertIn("Hello0/0.0@lasote/stable from 'local' - Updated", client.out) - +@pytest.mark.tool_compiler # Needed only because it assume that a settings.compiler is detected class MultiRemoteTest(unittest.TestCase): def setUp(self): diff --git a/conans/test/functional/scm/scm_test.py b/conans/test/functional/scm/scm_test.py index e2740956ab6..e66212de337 100644 --- a/conans/test/functional/scm/scm_test.py +++ b/conans/test/functional/scm/scm_test.py @@ -1012,7 +1012,7 @@ def test_propset_own(self): client.run("export . user/channel") - +@pytest.mark.tool_git class SCMBlockUploadTest(unittest.TestCase): def test_upload_blocking_auto(self): diff --git a/conans/test/functional/scm/test_command_export.py b/conans/test/functional/scm/test_command_export.py index 8c2a8bdf359..7b5a87f661e 100644 --- a/conans/test/functional/scm/test_command_export.py +++ b/conans/test/functional/scm/test_command_export.py @@ -39,7 +39,7 @@ def test_no_repo(self, repo_type, autos): self.assertIn("ERROR: Not a valid '{}' repository".format(repo_type.lower()), self.client.out) - +@pytest.mark.tool_git class ExportCommandTestCase(unittest.TestCase): conanfile = textwrap.dedent("""\ from conans import ConanFile diff --git a/conans/test/functional/scm/test_git_shallow.py b/conans/test/functional/scm/test_git_shallow.py index 726b807ea94..4ba306f4a91 100644 --- a/conans/test/functional/scm/test_git_shallow.py +++ b/conans/test/functional/scm/test_git_shallow.py @@ -3,6 +3,7 @@ import textwrap import unittest +import pytest from parameterized import parameterized from parameterized.parameterized import parameterized_class @@ -12,6 +13,7 @@ from conans.util.files import load +@pytest.mark.tool_git @parameterized_class([{"shallow": True}, {"shallow": False}, {"shallow": None}, {"shallow": "None"}]) class GitShallowTestCase(unittest.TestCase): conanfile = textwrap.dedent(""" diff --git a/conans/test/functional/scm/test_local_modified.py b/conans/test/functional/scm/test_local_modified.py index 28502964398..a32ffce2820 100644 --- a/conans/test/functional/scm/test_local_modified.py +++ b/conans/test/functional/scm/test_local_modified.py @@ -3,11 +3,14 @@ import textwrap import unittest +import pytest + from conans.model.ref import ConanFileReference from conans.test.utils.tools import TestClient from conans.test.utils.scm import create_local_git_repo +@pytest.mark.tool_git class SCMFolderObsoleteTest(unittest.TestCase): conanfile = textwrap.dedent("""\ from conans import ConanFile, tools diff --git a/conans/test/functional/scm/test_scm_to_conandata.py b/conans/test/functional/scm/test_scm_to_conandata.py index f61c2549c5d..8179728b696 100644 --- a/conans/test/functional/scm/test_scm_to_conandata.py +++ b/conans/test/functional/scm/test_scm_to_conandata.py @@ -3,6 +3,7 @@ import textwrap import unittest +import pytest import yaml from conans.client.graph.python_requires import ConanPythonRequire @@ -85,6 +86,7 @@ class Recipe(ConanFile): self.assertIn("revision: 123", t.out) self.assertIn('url: weir"d', t.out) + @pytest.mark.tool_git def test_auto_is_replaced(self): conanfile = textwrap.dedent(""" import os diff --git a/conans/test/functional/scm/test_url_auto.py b/conans/test/functional/scm/test_url_auto.py index 4068876489f..e4e98b6fc66 100644 --- a/conans/test/functional/scm/test_url_auto.py +++ b/conans/test/functional/scm/test_url_auto.py @@ -3,6 +3,8 @@ import textwrap import unittest +import pytest + from conans.model.ref import ConanFileReference from conans.test.utils.tools import TestClient from conans.test.utils.scm import create_local_git_repo @@ -25,6 +27,7 @@ def setUp(self): self.client.current_folder = self.path self.client.run_command("git remote add origin https://url.to.be.sustituted") + @pytest.mark.tool_git def test_https(self): expected_url = 'https://myrepo.com.git' origin_url = 'https://username:password@myrepo.com.git' diff --git a/conans/test/functional/scm/test_verify_ssl.py b/conans/test/functional/scm/test_verify_ssl.py index bf77cf680f6..034ed5bc36a 100644 --- a/conans/test/functional/scm/test_verify_ssl.py +++ b/conans/test/functional/scm/test_verify_ssl.py @@ -3,6 +3,7 @@ import textwrap import unittest +import pytest from parameterized.parameterized import parameterized_class from conans.model.ref import ConanFileReference @@ -11,6 +12,7 @@ from conans.util.files import load +@pytest.mark.tool_git @parameterized_class([{"verify_ssl": True}, {"verify_ssl": False}, {"verify_ssl": None},{"verify_ssl": "None"}, ]) class GitVerifySSLTestCase(unittest.TestCase): diff --git a/conans/test/functional/scm/workflows/test_conanfile_in_repo_root.py b/conans/test/functional/scm/workflows/test_conanfile_in_repo_root.py index 4bcf93a0938..41ae726c5bc 100644 --- a/conans/test/functional/scm/workflows/test_conanfile_in_repo_root.py +++ b/conans/test/functional/scm/workflows/test_conanfile_in_repo_root.py @@ -80,6 +80,8 @@ def test_remote_monorepo_chdir(self): self.assertIn("Repo origin deduced by 'auto':", t.out) +@attr("git") +@pytest.mark.tool_git class GitConanfileInRepoRootTest(ConanfileInRepoRoot, unittest.TestCase): conanfile = ConanfileInRepoRoot.conanfile_base.format(extra_header="", diff --git a/conans/test/functional/scm/workflows/test_conanfile_in_subfolder.py b/conans/test/functional/scm/workflows/test_conanfile_in_subfolder.py index 7bb585bbc4c..fa85f01cad5 100644 --- a/conans/test/functional/scm/workflows/test_conanfile_in_subfolder.py +++ b/conans/test/functional/scm/workflows/test_conanfile_in_subfolder.py @@ -73,6 +73,8 @@ def test_remote_monorepo_chdir(self): self._run_remote_test(t, os.path.join(t.current_folder, "lib1"), self.path_to_conanfile) +@attr("git") +@pytest.mark.tool_git class GitConanfileInSubfolderTest(ConanfileInSubfolder, unittest.TestCase): conanfile = ConanfileInSubfolder.conanfile_base.format(extra_header="", diff --git a/conans/test/functional/scm/workflows/test_scm_subfolder.py b/conans/test/functional/scm/workflows/test_scm_subfolder.py index c5cae5f4bd6..c3fccc08a10 100644 --- a/conans/test/functional/scm/workflows/test_scm_subfolder.py +++ b/conans/test/functional/scm/workflows/test_scm_subfolder.py @@ -88,6 +88,8 @@ def test_remote_monorepo_chdir(self): self._run_remote_test(t, os.path.join(t.current_folder, "lib1"), self.path_to_conanfile) +@attr("git") +@pytest.mark.tool_git class GitConanfileInRepoRootTest(SCMSubfolder, unittest.TestCase): conanfile = SCMSubfolder.conanfile_base.format(extra_header="", diff --git a/conans/test/functional/settings/conan_settings_preprocessor_test.py b/conans/test/functional/settings/conan_settings_preprocessor_test.py index ba45c8d6d4f..c76ff0cc983 100644 --- a/conans/test/functional/settings/conan_settings_preprocessor_test.py +++ b/conans/test/functional/settings/conan_settings_preprocessor_test.py @@ -1,10 +1,13 @@ import platform import unittest +import pytest + from conans.test.utils.tools import TestClient from conans.util.files import load, save +@pytest.mark.tool_compiler class ConanSettingsPreprocessorTest(unittest.TestCase): def setUp(self): diff --git a/conans/test/functional/settings/cppstd/compiler_cppstd_test.py b/conans/test/functional/settings/cppstd/compiler_cppstd_test.py index 361e32b4c03..d95bd7fdb9e 100644 --- a/conans/test/functional/settings/cppstd/compiler_cppstd_test.py +++ b/conans/test/functional/settings/cppstd/compiler_cppstd_test.py @@ -4,6 +4,7 @@ import textwrap import unittest +import pytest from parameterized.parameterized import parameterized_class from conans.client.tools import environment_append, save @@ -113,6 +114,7 @@ def configure(self): " 'compiler.cppstd' together with 'cppstd'", t.out) +@pytest.mark.tool_compiler class UseCompilerCppStdSettingTests(unittest.TestCase): conanfile = textwrap.dedent(""" diff --git a/conans/test/functional/settings/libcxx_setting_test.py b/conans/test/functional/settings/libcxx_setting_test.py index c8a1a87b9c2..e9578a49681 100644 --- a/conans/test/functional/settings/libcxx_setting_test.py +++ b/conans/test/functional/settings/libcxx_setting_test.py @@ -2,12 +2,15 @@ import textwrap import unittest +import pytest + from conans.test.utils.tools import TestClient class LibcxxSettingTest(unittest.TestCase): @unittest.skipIf(platform.system() == "Windows", "Not in Windows") + @pytest.mark.tool_cmake def test_declared_stdlib_and_passed(self): file_content = textwrap.dedent(''' from conans import ConanFile, CMake diff --git a/conans/test/functional/symlinks/symlink_package_test.py b/conans/test/functional/symlinks/symlink_package_test.py index 54ce577494a..8ba8148f5d6 100644 --- a/conans/test/functional/symlinks/symlink_package_test.py +++ b/conans/test/functional/symlinks/symlink_package_test.py @@ -1,12 +1,15 @@ import platform import unittest +import pytest + from conans.test.utils.tools import TestClient class SymlinkPackageTest(unittest.TestCase): @unittest.skipUnless(platform.system() in ("Linux", "Darwin"), "Requires Symlinks") + @pytest.mark.tool_compiler def test_symlink_created(self): conanfile = """from conans import ConanFile import os diff --git a/conans/test/functional/ui/json_output_test.py b/conans/test/functional/ui/json_output_test.py index aca3446b573..f8020a9176c 100644 --- a/conans/test/functional/ui/json_output_test.py +++ b/conans/test/functional/ui/json_output_test.py @@ -3,6 +3,8 @@ import textwrap import unittest +import pytest + from conans.model.build_info import DEFAULT_LIB from conans.model.ref import ConanFileReference from conans.test.assets.cpp_test_files import cpp_hello_conan_files @@ -16,6 +18,7 @@ def setUp(self): self.servers = {"default": TestServer()} self.client = TestClient(servers=self.servers) + @pytest.mark.tool_compiler def test_simple_fields(self): # Result of a create files = cpp_hello_conan_files("CC", "1.0", build=False) @@ -77,6 +80,7 @@ def test_simple_fields(self): self.assertFalse(my_json["installed"][0]["packages"][0]["downloaded"]) self.assertTrue(my_json["installed"][0]["packages"][0]["cpp_info"]) + @pytest.mark.tool_compiler def test_errors(self): # Missing recipe @@ -125,6 +129,7 @@ def build(self): self.assertIn("CC/1.0@private_user/channel: Error in build() method, line 36", my_json["installed"][0]["packages"][0]["error"]["description"]) + @pytest.mark.tool_compiler def test_json_generation(self): files = cpp_hello_conan_files("CC", "1.0", build=False) diff --git a/conans/test/functional/workspace/workspace_test.py b/conans/test/functional/workspace/workspace_test.py index a0187c14607..2e792e5cbf7 100644 --- a/conans/test/functional/workspace/workspace_test.py +++ b/conans/test/functional/workspace/workspace_test.py @@ -3,6 +3,7 @@ import unittest from textwrap import dedent +import pytest import six import time @@ -154,6 +155,7 @@ def test_parse(self): "does not define path"): Workspace(path, None) + @pytest.mark.tool_compiler def test_simple(self): client = TestClient() @@ -191,6 +193,7 @@ def files(name, depend=None): self.assertTrue(os.path.exists(os.path.join(client.current_folder, sub, f))) @parameterized.expand([("csv",), ("list",), (("abbreviated_list"))]) + @pytest.mark.tool_cmake def test_multiple_roots(self, root_attribute_format): # https://github.com/conan-io/conan/issues/4720 client = TestClient() @@ -242,6 +245,7 @@ def files(name, depend=None): b_cmake = client.load(os.path.join("B", "conanbuildinfo.cmake")) self.assertIn("set(CONAN_LIBS helloD ${CONAN_LIBS})", b_cmake) + @pytest.mark.tool_compiler def test_transitivity(self): # https://github.com/conan-io/conan/issues/4720 client = TestClient() @@ -289,6 +293,7 @@ def files(name, depend=None): b_cmake = client.load(os.path.join("B", "conanbuildinfo.cmake")) self.assertIn("set(CONAN_LIBS helloC helloD ${CONAN_LIBS})", b_cmake) + @pytest.mark.tool_cmake def test_missing_layout_cmake(self): # Specifying cmake generator without layout file raised exception # https://github.com/conan-io/conan/issues/4752 @@ -319,6 +324,7 @@ def files(name, depend=None): self.assertIn("HelloD/0.1@lasote/stable from user folder - Editable", client.out) self.assertIn("HelloD/0.1@lasote/stable from user folder - Editable", client.out) + @pytest.mark.tool_cmake def test_simple_build(self): client = TestClient() @@ -391,6 +397,7 @@ def files(name, depend=None): self.assertIn("Hello World B Debug!", client.out) self.assertIn("Hello World A Debug!", client.out) + @pytest.mark.tool_cmake def test_simple_out_of_source_build(self): client = TestClient() @@ -464,6 +471,7 @@ def files(name, depend=None): self.assertIn("Hello World B Debug!", client.out) self.assertIn("Hello World A Debug!", client.out) + @pytest.mark.tool_cmake def test_complete_single_conf_build(self): client = TestClient() @@ -800,6 +808,7 @@ def files(name, depend=None): conanbuildinfo = client.load(os.path.join("A", "build", "conanbuildinfo.cmake")) self.assertIn("set(CONAN_LIBS_TOOL MyToolLib)", conanbuildinfo) + @pytest.mark.tool_compiler def test_per_package_layout(self): client = TestClient() @@ -844,6 +853,7 @@ def files(name, depend=None): self.assertIn("myincludeC", cmake) self.assertIn("myincludeB", cmake) + @pytest.mark.tool_compiler def test_generators(self): client = TestClient() @@ -892,6 +902,7 @@ def files(name, depend=None): self.assertTrue(os.path.exists(os.path.join(client.current_folder, "conanworkspace.cmake"))) + @pytest.mark.tool_cmake def test_gen_subdirectories(self): client = TestClient() diff --git a/conans/test/integration/basic_build_test.py b/conans/test/integration/basic_build_test.py index f518bfe21d7..5ce77f1eab1 100644 --- a/conans/test/integration/basic_build_test.py +++ b/conans/test/integration/basic_build_test.py @@ -16,12 +16,14 @@ @pytest.mark.slow class BasicBuildTest(unittest.TestCase): + @pytest.mark.tool_cmake def test_build_cmake(self): for cmd, lang, static, pure_c in [("install .", 0, True, True), ("install . -o language=1 -o static=False", 1, False, False)]: build(self, cmd, static, pure_c, use_cmake=True, lang=lang) + @pytest.mark.tool_compiler def test_build_default(self): """ build default (gcc in nix, VS in win) """ if platform.system() == "SunOS": diff --git a/conans/test/integration/complete_test.py b/conans/test/integration/complete_test.py index 934628dc1de..df0ceedcb22 100644 --- a/conans/test/integration/complete_test.py +++ b/conans/test/integration/complete_test.py @@ -13,6 +13,7 @@ @attr("slow") @pytest.mark.slow +@pytest.mark.tool_cmake class CompleteFlowTest(unittest.TestCase): def test_reuse_complete_urls(self): diff --git a/conans/test/integration/shared_chain_test.py b/conans/test/integration/shared_chain_test.py index 75ea869cb7e..93a3e648a1a 100644 --- a/conans/test/integration/shared_chain_test.py +++ b/conans/test/integration/shared_chain_test.py @@ -28,6 +28,7 @@ def _export_upload(self, name, version=None, deps=None): rmdir(conan.current_folder) shutil.rmtree(conan.cache.store, ignore_errors=True) + @pytest.mark.tool_compiler def test_uploaded_chain(self): self._export_upload("Hello0", "0.1") self._export_upload("Hello1", "0.1", ["Hello0/0.1@lasote/stable"]) diff --git a/conans/test/integration/toolchains/test_cmake.py b/conans/test/integration/toolchains/test_cmake.py index f5f2a71c330..3afadcb62fc 100644 --- a/conans/test/integration/toolchains/test_cmake.py +++ b/conans/test/integration/toolchains/test_cmake.py @@ -15,6 +15,7 @@ @attr("toolchain") @pytest.mark.toolchain +@pytest.mark.tool_cmake class Base(unittest.TestCase): conanfile = textwrap.dedent(""" @@ -348,6 +349,7 @@ def _verify_out(marker=">>"): @attr("toolchain") @pytest.mark.toolchain +@pytest.mark.tool_cmake class CMakeInstallTest(unittest.TestCase): def test_install(self): diff --git a/conans/test/integration/toolchains/test_make.py b/conans/test/integration/toolchains/test_make.py index 86eff08fb05..6339c5f5264 100644 --- a/conans/test/integration/toolchains/test_make.py +++ b/conans/test/integration/toolchains/test_make.py @@ -5,7 +5,6 @@ import pytest from nose.plugins.attrib import attr - from conans.client.tools import which from conans.test.assets.sources import gen_function_h, gen_function_cpp from conans.test.utils.tools import TestClient @@ -15,6 +14,7 @@ @attr("toolchain") @pytest.mark.slow @pytest.mark.toolchain +@pytest.mark.tool_autotools class MakeToolchainTest(unittest.TestCase): @unittest.skipUnless(platform.system() in ["Linux"], "Requires linux") diff --git a/conans/test/unittests/client/cmd/export/test_capture_export_scm_data.py b/conans/test/unittests/client/cmd/export/test_capture_export_scm_data.py index bb8f8b2272a..cd6fe6da373 100644 --- a/conans/test/unittests/client/cmd/export/test_capture_export_scm_data.py +++ b/conans/test/unittests/client/cmd/export/test_capture_export_scm_data.py @@ -4,18 +4,21 @@ import unittest import mock +import pytest +from nose.plugins.attrib import attr from parameterized import parameterized from conans.client.cmd.export import _capture_scm_auto_fields from conans.client.tools.scm import Git from conans.model.ref import ConanFileReference -from conans.test.utils.test_files import temp_folder from conans.test.utils.mocks import TestBufferConanOutput from conans.test.utils.scm import create_local_git_repo +from conans.test.utils.test_files import temp_folder from conans.util.files import save -from conans.paths.package_layouts.package_cache_layout import PackageCacheLayout +@attr("git") +@pytest.mark.tool_git @mock.patch("conans.client.cmd.export._replace_scm_data_in_recipe", return_value=None) class CaptureExportSCMDataTest(unittest.TestCase): diff --git a/conans/test/unittests/client/cmd/export_test.py b/conans/test/unittests/client/cmd/export_test.py index 2d0e0ea9551..7d80526bb4a 100644 --- a/conans/test/unittests/client/cmd/export_test.py +++ b/conans/test/unittests/client/cmd/export_test.py @@ -3,6 +3,8 @@ import unittest from collections import namedtuple +import pytest + from conans.client.cmd.export import _replace_scm_data_in_conanfile from conans.client.loader import _parse_conanfile from conans.model.ref import ConanFileReference @@ -119,6 +121,7 @@ def test_conanfile_none(self): after_recipe = '' self._do_actual_test(scm_data=scm_data, after_scm=after_scm, after_recipe=after_recipe) + @pytest.mark.tool_git def test_scm_from_superclass(self): client = TurboTestClient() conanfile = '''from conans import ConanFile @@ -175,6 +178,7 @@ class ModuleConan(python_requires(baseline).get_conanfile()): class SCMUpload(unittest.TestCase): + @pytest.mark.tool_git def test_scm_sources(self): """ Test conan_sources.tgz is deleted in server when removing 'exports_sources' and using 'scm'""" diff --git a/conans/test/unittests/client/source/test_run_scm.py b/conans/test/unittests/client/source/test_run_scm.py index 3880f80f85e..e064af844d0 100644 --- a/conans/test/unittests/client/source/test_run_scm.py +++ b/conans/test/unittests/client/source/test_run_scm.py @@ -4,6 +4,7 @@ import unittest import mock +import pytest from conans.client.source import _run_cache_scm, _run_local_scm from conans.client.tools.scm import Git @@ -13,6 +14,7 @@ from conans.test.utils.scm import create_local_git_repo +@pytest.mark.tool_git class RunSCMTest(unittest.TestCase): def setUp(self): diff --git a/conans/test/unittests/client/tools/scm/test_git.py b/conans/test/unittests/client/tools/scm/test_git.py index 986fc9190c5..182652ab529 100644 --- a/conans/test/unittests/client/tools/scm/test_git.py +++ b/conans/test/unittests/client/tools/scm/test_git.py @@ -17,6 +17,8 @@ from conans.util.files import save +@attr('git') +@pytest.mark.tool_git class GitRemoteUrlTest(unittest.TestCase): def test_remove_credentials(self): @@ -360,7 +362,8 @@ def test_git_commit_message(self): self.assertEqual("dev", git.get_branch()) self.assertEqual("first commit", git.get_commit_message()) - +@attr('git') +@pytest.mark.tool_git class GitToolsTests(unittest.TestCase): def setUp(self): diff --git a/conans/test/unittests/client/tools/system_pm_test.py b/conans/test/unittests/client/tools/system_pm_test.py index 5aa449c2232..9eb81f9a644 100644 --- a/conans/test/unittests/client/tools/system_pm_test.py +++ b/conans/test/unittests/client/tools/system_pm_test.py @@ -481,6 +481,9 @@ def test_system_package_tool_installed(self): spt = SystemPackageTool(tool=ChocolateyTool(output=self.out), output=self.out) # Git is not installed by default on Chocolatey expected_package = "chocolatey" + else: + if platform.system() != "Windows" and not which("git"): + return # The expected should be installed on development/testing machines self.assertTrue(spt._tool.installed(expected_package)) self.assertTrue(spt.installed(expected_package)) diff --git a/conans/test/unittests/client/tools/win/vcvars_test.py b/conans/test/unittests/client/tools/win/vcvars_test.py index 8ec34e4ac4a..57ece5289ab 100644 --- a/conans/test/unittests/client/tools/win/vcvars_test.py +++ b/conans/test/unittests/client/tools/win/vcvars_test.py @@ -3,6 +3,7 @@ import unittest import mock +import pytest import six from mock.mock import patch from six import StringIO @@ -165,6 +166,7 @@ def test_vcvars_constrained(self): # Not raising tools.vcvars_command(settings, force=True, output=output) + @pytest.mark.tool_compiler def test_vcvars_context_manager(self): conanfile = """ from conans import ConanFile, tools diff --git a/conans/test/unittests/util/detect_test.py b/conans/test/unittests/util/detect_test.py index 28db56c4312..25c689833eb 100644 --- a/conans/test/unittests/util/detect_test.py +++ b/conans/test/unittests/util/detect_test.py @@ -3,6 +3,7 @@ import subprocess import unittest +import pytest from parameterized import parameterized from conans.client import tools @@ -14,6 +15,7 @@ class DetectTest(unittest.TestCase): + @pytest.mark.tool_compiler def test_detect_default_compilers(self): platform_default_compilers = { "Linux": "gcc", diff --git a/conans/test/unittests/util/pkg_config_test.py b/conans/test/unittests/util/pkg_config_test.py index 421a857f49f..9bffaac7b28 100644 --- a/conans/test/unittests/util/pkg_config_test.py +++ b/conans/test/unittests/util/pkg_config_test.py @@ -30,7 +30,8 @@ @attr("unix") -@pytest.mark.tool_unix +@pytest.mark.unix +@pytest.mark.tool_autotools class PkgConfigTest(unittest.TestCase): def test_negative(self): if platform.system() == "Windows": diff --git a/conans/test/unittests/util/tools_test.py b/conans/test/unittests/util/tools_test.py index 4dfa103b2c8..0e79df7e3cf 100644 --- a/conans/test/unittests/util/tools_test.py +++ b/conans/test/unittests/util/tools_test.py @@ -643,7 +643,6 @@ def test_detect_windows_subsystem(self): @attr('slow') @pytest.mark.slow @attr('local_bottle') - @pytest.mark.tool_local_bottle def test_get_filename_download(self): # Create a tar file to be downloaded from server with tools.chdir(tools.mkdir_tmp()): @@ -711,7 +710,6 @@ def error_url(): @attr('slow') @pytest.mark.slow @attr('local_bottle') - @pytest.mark.tool_local_bottle def test_get_gunzip(self): # Create a tar file to be downloaded from server tmp = temp_folder() @@ -808,7 +806,7 @@ def test_check_output_runner(self): output = check_output_runner(["echo", payload], stderr=subprocess.STDOUT) self.assertIn(payload, str(output)) - + @pytest.mark.tool_file # Needs the "file" command, not by default in linux def test_unix_to_dos_unit(self): def save_file(contents):