def test_cmake_find_package_multi_links_flags(): # https://github.com/conan-io/conan/issues/8703 conanfile = ConanFile(Mock(), None) conanfile.settings = "os", "compiler", "build_type", "arch" conanfile.initialize( Settings({ "os": ["Windows"], "compiler": ["gcc"], "build_type": ["Release"], "arch": ["x86"] }), EnvValues()) conanfile.settings.build_type = "Release" conanfile.settings.arch = "x86" cpp_info = CppInfo("mypkg", "dummy_root_folder1") cpp_info.sharedlinkflags = ["/NODEFAULTLIB", "/OTHERFLAG"] cpp_info.exelinkflags = ["/OPT:NOICF"] conanfile.deps_cpp_info.add("mypkg", cpp_info) gen = CMakeFindPackageMultiGenerator(conanfile) files = gen.content d = files["mypkgTarget-release.cmake"] assert "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:-OPT:NOICF>" in d assert "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>:-NODEFAULTLIB;-OTHERFLAG>" in d assert "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:-NODEFAULTLIB;-OTHERFLAG>" in d
def test_msbuild_toolset(): settings = Settings({ "build_type": ["Release"], "compiler": { "msvc": { "version": ["193"], "toolset": [None, "v142_xp"] } }, "os": ["Windows"], "arch": ["x86_64"] }) conanfile = ConanFile(Mock(), None) conanfile.settings = "os", "compiler", "build_type", "arch" conanfile.initialize(settings, EnvValues()) conanfile.settings.build_type = "Release" conanfile.settings.compiler = "msvc" conanfile.settings.compiler.version = "193" conanfile.settings.os = "Windows" conanfile.settings.arch = "x86_64" msbuild = MSBuildToolchain(conanfile) assert 'v143' in msbuild.toolset conanfile.settings.compiler.toolset = "v142_xp" msbuild = MSBuildToolchain(conanfile) assert 'v142_xp' in msbuild.toolset
def test_apple_cmake_osx_sysroot_sdk_mandatory(os, os_sdk, arch, expected_sdk): """ Testing if CMAKE_OSX_SYSROOT is correctly set. Issue related: https://github.com/conan-io/conan/issues/10275 """ c = ConanFile(Mock(), None) c.settings = "os", "compiler", "build_type", "arch" c.initialize(Settings.loads(get_default_settings_yml()), EnvValues()) c.settings.os = os c.settings.os.sdk = os_sdk c.settings.build_type = "Release" c.settings.arch = arch c.settings.compiler = "apple-clang" c.settings.compiler.version = "13.0" c.settings.compiler.libcxx = "libc++" c.settings.compiler.cppstd = "17" c.conf = Conf() c.folders.set_base_generators(".") c._conan_node = Mock() c._conan_node.dependencies = [] with pytest.raises(ConanException) as excinfo: CMakeToolchain(c).content() assert "Please, specify a suitable value for os.sdk." % expected_sdk in str( excinfo.value)
def test_win(self): install_dir = "C:\\Intel" with mock.patch("platform.system", mock.MagicMock(return_value="Windows")),\ mock.patch("conans.client.tools.intel.intel_installation_path", mock.MagicMock(return_value=install_dir)): settings = Settings.loads(get_default_settings_yml()) settings.os = "Windows" settings.compiler = "intel" settings.compiler.base = "Visual Studio" settings.arch = "ppc32" with self.assertRaises(ConanException): compilervars_command(MockConanfile(settings)) path = os.path.join(install_dir, "bin", "compilervars.bat") settings.arch = "x86" cvars = compilervars_command(MockConanfile(settings)) expected = '"%s" -arch ia32' % path self.assertEqual(expected, cvars) settings.compiler.base.version = "16" cvars = compilervars_command(MockConanfile(settings)) expected = '"%s" -arch ia32 vs2019' % path self.assertEqual(expected, cvars) settings.arch = "x86_64" expected = '"%s" -arch intel64 vs2019' % path cvars = compilervars_command(MockConanfile(settings)) self.assertEqual(expected, cvars)
def test_mac(self): install_dir = "/opt/intel" with mock.patch("platform.system", mock.MagicMock(return_value="Darwin")),\ mock.patch("conans.client.tools.intel.intel_installation_path", mock.MagicMock(return_value="/opt/intel")): settings = Settings.loads(get_default_settings_yml()) settings.os = "Macos" settings.compiler = "intel" settings.compiler.base = "apple-clang" settings.arch = "ppc32" with self.assertRaises(ConanException): compilervars_command(MockConanfile(settings)) path = os.path.join(install_dir, "bin", "compilervars.sh") settings.arch = "x86" cvars = compilervars_command(MockConanfile(settings)) expected = 'COMPILERVARS_PLATFORM=mac COMPILERVARS_ARCHITECTURE=ia32 . ' \ '"%s" -arch ia32 -platform mac' % path self.assertEqual(expected, cvars) settings.arch = "x86_64" expected = 'COMPILERVARS_PLATFORM=mac COMPILERVARS_ARCHITECTURE=intel64 . ' \ '"%s" -arch intel64 -platform mac' % path cvars = compilervars_command(MockConanfile(settings)) self.assertEqual(expected, cvars)
def conanfile_apple(): c = ConanFile(Mock(), None) c.settings = "os", "compiler", "build_type", "arch" c.initialize( Settings({ "os": { "Macos": { "version": ["10.15"] } }, "compiler": { "apple-clang": { "libcxx": ["libc++"] } }, "build_type": ["Release"], "arch": ["x86"] }), EnvValues()) c.settings.build_type = "Release" c.settings.arch = "x86" c.settings.compiler = "apple-clang" c.settings.compiler.libcxx = "libc++" c.settings.os = "Macos" c.settings.os.version = "10.15" c.conf = Conf() c.folders.set_base_generators(".") c._conan_node = Mock() c._conan_node.dependencies = [] return c
def conanfile_windows_fpic(): c = ConanFile(Mock(), None) c.settings = "os", "compiler", "build_type", "arch" c.options = { "fPIC": [True, False], } c.default_options = { "fPIC": True, } c.initialize( Settings({ "os": ["Windows"], "compiler": { "gcc": { "libcxx": ["libstdc++"] } }, "build_type": ["Release"], "arch": ["x86"] }), EnvValues()) c.settings.build_type = "Release" c.settings.arch = "x86" c.settings.compiler = "gcc" c.settings.compiler.libcxx = "libstdc++" c.settings.os = "Windows" c.conf = Conf() c.folders.set_base_generators(".") c._conan_node = Mock() c._conan_node.dependencies = [] return c
def test_msvc_xp_toolsets(): c = ConanFile(Mock(), None) c.settings = "os", "compiler", "build_type", "arch" c.initialize( Settings({ "os": ["Windows"], "compiler": { "msvc": { "version": ["170"], "update": [None], "cppstd": ["98"], "toolset": [None, "v110_xp"] } }, "build_type": ["Release"], "arch": ["x86"] }), EnvValues()) c.settings.build_type = "Release" c.settings.arch = "x86" c.settings.compiler = "msvc" c.settings.compiler.version = "170" c.settings.compiler.toolset = "v110_xp" c.settings.compiler.cppstd = "98" c.settings.os = "Windows" c.conf = Conf() c.folders.set_base_generators(".") c._conan_node = Mock() c._conan_node.dependencies = [] toolchain = CMakeToolchain(c) assert 'CMAKE_GENERATOR_TOOLSET "v110_xp"' in toolchain.content assert 'Visual Studio 11 2012' in toolchain.generator # As by the CMake docs, this has no effect for VS < 2015 assert 'CMAKE_CXX_STANDARD 98' in toolchain.content
def test_vcvars_constrained(self): new_out = StringIO() output = ConanOutput(new_out) text = """os: [Windows] compiler: Visual Studio: version: ["14"] """ settings = Settings.loads(text) settings.os = "Windows" settings.compiler = "Visual Studio" with six.assertRaisesRegex( self, ConanException, "compiler.version setting required for vcvars not defined"): tools.vcvars_command(settings, output=output) new_out = StringIO() output = ConanOutput(new_out) settings.compiler.version = "14" with tools.environment_append({"vs140comntools": "path/to/fake"}): tools.vcvars_command(settings, output=output) with tools.environment_append({"VisualStudioVersion": "12"}): with six.assertRaisesRegex( self, ConanException, "Error, Visual environment already set to 12"): tools.vcvars_command(settings, output=output) with tools.environment_append({"VisualStudioVersion": "12"}): # Not raising tools.vcvars_command(settings, force=True, output=output)
def test_msbuild_standard(): settings = Settings({ "build_type": ["Release"], "compiler": { "msvc": { "version": ["19.3"], "cppstd": ["20"] } }, "os": ["Windows"], "arch": ["x86_64"] }) conanfile = ConanFile(Mock(), None) conanfile.folders.set_base_generators(".") conanfile.install_folder = os.getcwd() conanfile.conf = ConfDefinition() conanfile.settings = "os", "compiler", "build_type", "arch" conanfile.initialize(settings, EnvValues()) conanfile.settings.build_type = "Release" conanfile.settings.compiler = "msvc" conanfile.settings.compiler.version = "19.3" conanfile.settings.compiler.cppstd = "20" conanfile.settings.os = "Windows" conanfile.settings.arch = "x86_64" msbuild = MSBuildToolchain(conanfile) with mock.patch("conan.tools.microsoft.visual.vcvars_path", mock.MagicMock(return_value=".")): msbuild.generate() assert '<LanguageStandard>stdcpp20</LanguageStandard>' in load( 'conantoolchain_release_x64.props')
def conanfile(): c = ConanFile(Mock(), None) c.settings = "os", "compiler", "build_type", "arch" c.initialize( Settings({ "os": ["Windows"], "compiler": { "gcc": { "libcxx": ["libstdc++"] } }, "build_type": ["Release"], "arch": ["x86"] }), EnvValues()) c.settings.build_type = "Release" c.settings.arch = "x86" c.settings.compiler = "gcc" c.settings.compiler.libcxx = "libstdc++" c.settings.os = "Windows" c.conf = Conf() tmp_folder = temp_folder() c.folders.set_base_generators(tmp_folder) c.folders.generators = "." c.folders.set_base_build(tmp_folder) return c
def test_vcvars_dict_diff(self): text = """ os: [Windows] compiler: Visual Studio: version: ["14"] """ settings = Settings.loads(text) settings.os = "Windows" settings.compiler = "Visual Studio" settings.compiler.version = "14" with tools.environment_append({"MYVAR": "1"}): ret = vcvars_dict(settings, only_diff=False, output=self.output) self.assertIn("MYVAR", ret) self.assertIn("VCINSTALLDIR", ret) ret = vcvars_dict(settings, output=self.output) self.assertNotIn("MYVAR", ret) self.assertIn("VCINSTALLDIR", ret) my_lib_paths = "C:\\PATH\\TO\\MYLIBS;C:\\OTHER_LIBPATH" with tools.environment_append({"LIBPATH": my_lib_paths}): ret = vcvars_dict(settings, only_diff=False, output=self.output) str_var_value = os.pathsep.join(ret["LIBPATH"]) self.assertTrue(str_var_value.endswith(my_lib_paths)) # Now only a diff, it should return the values as a list, but without the old values ret = vcvars_dict(settings, only_diff=True, output=self.output) self.assertEqual(ret["LIBPATH"], str_var_value.split(os.pathsep)[0:-2]) # But if we apply both environments, they are composed correctly with tools.environment_append(ret): self.assertEqual(os.environ["LIBPATH"], str_var_value)
def conanfile_linux_fpic(): c = ConanFile(Mock(), None) c.settings = "os", "compiler", "build_type", "arch" c.options = { "fPIC": [True, False], } c.default_options = { "fPIC": False, } c.initialize( Settings({ "os": ["Linux"], "compiler": { "gcc": { "version": ["11"], "cppstd": ["20"] } }, "build_type": ["Release"], "arch": ["x86_64"] }), EnvValues()) c.settings.build_type = "Release" c.settings.arch = "x86_64" c.settings.compiler = "gcc" c.settings.compiler.version = "11" c.settings.compiler.cppstd = "20" c.settings.os = "Linux" c.conf = Conf() c.folders.set_base_generators(".") c._conan_node = Mock() c._conan_node.dependencies = [] return c
def test_cpp_info_name_cmakedeps_components(): conanfile = ConanFile(Mock(), None) conanfile.settings = "os", "compiler", "build_type", "arch" conanfile.initialize( Settings({ "os": ["Windows"], "compiler": ["gcc"], "build_type": ["Release"], "arch": ["x86"] }), EnvValues()) cpp_info = CppInfo("mypkg", "dummy_root_folder1") cpp_info.names["cmake_find_package_multi"] = "GlobakPkgName1" cpp_info.components["mycomp"].names[ "cmake_find_package_multi"] = "MySuperPkg1" cpp_info.filenames["cmake_find_package_multi"] = "ComplexFileName1" conanfile.deps_cpp_info.add("mypkg", DepCppInfo(cpp_info)) cmakedeps = CMakeDeps(conanfile) files = cmakedeps.content assert "TARGET GlobakPkgName1::MySuperPkg1" in files[ "ComplexFileName1Config.cmake"] with pytest.raises( ConanException, match="'mypkg' defines information for 'cmake_find_package_multi'" ): with environment_append({CONAN_V2_MODE_ENVVAR: "1"}): _ = cmakedeps.content
def test_msbuild_standard(): test_folder = temp_folder() settings = Settings({ "build_type": ["Release"], "compiler": { "msvc": { "version": ["193"], "cppstd": ["20"] } }, "os": ["Windows"], "arch": ["x86_64"] }) conanfile = ConanFile(Mock(), None) conanfile.folders.set_base_generators(test_folder) conanfile.folders.set_base_install(test_folder) conanfile.conf = Conf() conanfile.conf["tools.microsoft.msbuild:installation_path"] = "." conanfile.settings = "os", "compiler", "build_type", "arch" conanfile.initialize(settings, EnvValues()) conanfile.settings.build_type = "Release" conanfile.settings.compiler = "msvc" conanfile.settings.compiler.version = "193" conanfile.settings.compiler.cppstd = "20" conanfile.settings.os = "Windows" conanfile.settings.arch = "x86_64" msbuild = MSBuildToolchain(conanfile) props_file = os.path.join(test_folder, 'conantoolchain_release_x64.props') msbuild.generate() assert '<LanguageStandard>stdcpp20</LanguageStandard>' in load(props_file)
def test_msbuild_toolset_for_intel_cc(mode, expected_toolset): settings = Settings({ "build_type": ["Release"], "compiler": { "intel-cc": { "version": ["2021.3"], "mode": [mode] }, "msvc": { "version": ["193"], "cppstd": ["20"] } }, "os": ["Windows"], "arch": ["x86_64"] }) conanfile = ConanFile(Mock(), None) conanfile.settings = "os", "compiler", "build_type", "arch" conanfile.initialize(settings, EnvValues()) conanfile.settings.build_type = "Release" conanfile.settings.compiler = "intel-cc" conanfile.settings.compiler.version = "2021.3" conanfile.settings.compiler.mode = mode conanfile.settings.os = "Windows" conanfile.settings.arch = "x86_64" msbuild = MSBuildToolchain(conanfile) assert expected_toolset == msbuild.toolset
def test_libcxx_abi_flag(): c = ConanFile(Mock(), None) c.settings = "os", "compiler", "build_type", "arch" c.initialize(Settings.loads(get_default_settings_yml()), EnvValues()) c.settings.build_type = "Release" c.settings.arch = "x86_64" c.settings.compiler = "gcc" c.settings.compiler.version = "11" c.settings.compiler.cppstd = "20" c.settings.compiler.libcxx = "libstdc++" c.settings.os = "Linux" c.conf = Conf() c.folders.set_base_generators(".") c._conan_node = Mock() c._conan_node.dependencies = [] toolchain = CMakeToolchain(c) content = toolchain.content assert '_GLIBCXX_USE_CXX11_ABI=0' in content c.settings.compiler.libcxx = "libstdc++11" toolchain = CMakeToolchain(c) content = toolchain.content # by default, no flag is output anymore, it is assumed the compiler default assert 'GLIBCXX_USE_CXX11_ABI' not in content # recipe workaround for older distros toolchain.blocks["libcxx"].values["glibcxx"] = "1" content = toolchain.content assert '_GLIBCXX_USE_CXX11_ABI=1' in content # but maybe the conf is better c.conf["tools.gnu:define_libcxx11_abi"] = True toolchain = CMakeToolchain(c) content = toolchain.content assert '_GLIBCXX_USE_CXX11_ABI=1' in content
def conanfile_msvc(): c = ConanFile(Mock(), None) c.settings = "os", "compiler", "build_type", "arch" c.initialize( Settings({ "os": ["Windows"], "compiler": { "msvc": { "version": ["193"], "update": [None], "cppstd": ["20"] } }, "build_type": ["Release"], "arch": ["x86"] }), EnvValues()) c.settings.build_type = "Release" c.settings.arch = "x86" c.settings.compiler = "msvc" c.settings.compiler.version = "193" c.settings.compiler.cppstd = "20" c.settings.os = "Windows" c.conf = Conf() c.folders.set_base_generators(".") c._conan_node = Mock() c._conan_node.dependencies = [] return c
def test_cmake_deps_links_flags(): # https://github.com/conan-io/conan/issues/8703 conanfile = ConanFile(Mock(), None) conanfile._conan_node = Mock() conanfile._conan_node.context = "host" conanfile.settings = "os", "compiler", "build_type", "arch" conanfile.initialize(Settings({"os": ["Windows"], "compiler": ["gcc"], "build_type": ["Release"], "arch": ["x86"]}), EnvValues()) conanfile.settings.build_type = "Release" conanfile.settings.arch = "x86" cpp_info = CppInfo("mypkg", "dummy_root_folder1") # https://github.com/conan-io/conan/issues/8811 regression, fix with explicit - instead of / cpp_info.sharedlinkflags = ["-NODEFAULTLIB", "-OTHERFLAG"] cpp_info.exelinkflags = ["-OPT:NOICF"] conanfile_dep = ConanFile(Mock(), None) conanfile_dep.cpp_info = cpp_info conanfile_dep._conan_node = Mock() conanfile_dep._conan_node.ref = ConanFileReference.loads("mypkg/1.0") conanfile_dep._conan_node.context = "host" conanfile_dep.package_folder = "/path/to/folder_dep" with mock.patch('conans.ConanFile.dependencies', new_callable=mock.PropertyMock) as mock_deps: req = Requirement(ConanFileReference.loads("OriginalDepName/1.0")) mock_deps.return_value = ConanFileDependencies({req: ConanFileInterface(conanfile_dep)}) cmakedeps = CMakeDeps(conanfile) files = cmakedeps.content data_cmake = files["mypkg-release-x86-data.cmake"] assert "set(mypkg_SHARED_LINK_FLAGS_RELEASE -NODEFAULTLIB;-OTHERFLAG)" in data_cmake assert "set(mypkg_EXE_LINK_FLAGS_RELEASE -OPT:NOICF)" in data_cmake
def setUp(self): settings = Settings() self.profile = Profile() self.profile.processed_settings = settings output = TestBufferConanOutput() self.loader = ConanFileLoader(None, output, ConanPythonRequire(None, None))
def setUp(self): settings = Settings() self.profile = Profile() self.profile._settings = settings self.profile._user_options = None self.profile._env_values = None self.conanfile_txt_path = os.path.join(temp_folder(), "conanfile.txt") output = TestBufferConanOutput() self.loader = ConanFileLoader(None, output, None)
def test_package_manager_distro(distro, tool): with mock.patch("platform.system", return_value="Linux"): with mock.patch("distro.id", return_value=distro): with mock.patch('conans.ConanFile.context', new_callable=PropertyMock) as context_mock: context_mock.return_value = "host" conanfile = ConanFileMock() conanfile.settings = Settings() manager = _SystemPackageManagerTool(conanfile) assert tool == manager.get_default_tool()
def test_sudo_str(sudo, sudo_askpass, expected_str): conanfile = ConanFileMock() conanfile.conf = Conf() conanfile.settings = Settings() conanfile.conf["tools.system.package_manager:sudo"] = sudo conanfile.conf["tools.system.package_manager:sudo_askpass"] = sudo_askpass with mock.patch('conans.ConanFile.context', new_callable=PropertyMock) as context_mock: context_mock.return_value = "host" apt = Apt(conanfile) assert apt.sudo_str == expected_str
def prepend_values_test(self): """ Check list values are only prepended once """ conanfile = ConanFile(TestBufferConanOutput(), None) conanfile.initialize(Settings({}), EnvValues.loads("PATH=[1,2,three]")) gen = VirtualEnvGenerator(conanfile) content = gen.content self.assertIn("PATH=\"1\":\"2\":\"three\"${PATH+:$PATH}", content["activate.sh"]) if platform.system() == "Windows": self.assertIn("PATH=1;2;three;%PATH%", content["activate.bat"])
def test_tools_check(tool_class, result): conanfile = ConanFileMock() conanfile.conf = Conf() conanfile.settings = Settings() conanfile.conf["tools.system.package_manager:tool"] = tool_class.tool_name with mock.patch('conans.ConanFile.context', new_callable=PropertyMock) as context_mock: context_mock.return_value = "host" tool = tool_class(conanfile) tool.check(["package"]) assert tool._conanfile.command == result
def test_msys2(): with mock.patch("platform.system", return_value="Windows"): with mock.patch('conans.ConanFile.context', new_callable=PropertyMock) as context_mock: context_mock.return_value = "host" conanfile = ConanFileMock() conanfile.conf = Conf() conanfile.settings = Settings() conanfile.conf["tools.microsoft.bash:subsystem"] = "msys2" manager = _SystemPackageManagerTool(conanfile) assert manager.get_default_tool() == "pacman"
def test_vcvars_with_store_echo(self): settings = Settings.loads(get_default_settings_yml()) settings.os = "WindowsStore" settings.os.version = "8.1" settings.compiler = "Visual Studio" settings.compiler.version = "14" cmd = tools.vcvars_command(settings, output=self.output) self.assertIn("store 8.1", cmd) with tools.environment_append({"VisualStudioVersion": "14"}): cmd = tools.vcvars_command(settings, output=self.output) self.assertEqual("echo Conan:vcvars already set", cmd)
def test_cpp_info_name_cmakedeps_components(using_properties): conanfile = ConanFile(Mock(), None) conanfile.settings = "os", "compiler", "build_type", "arch" conanfile.initialize( Settings({ "os": ["Windows"], "compiler": ["gcc"], "build_type": ["Release", "Debug"], "arch": ["x86", "x64"] }), EnvValues()) conanfile.settings.build_type = "Debug" conanfile.settings.arch = "x64" cpp_info = CppInfo("mypkg", "dummy_root_folder1") if using_properties: cpp_info.set_property("cmake_target_name", "GlobakPkgName1") cpp_info.components["mycomp"].set_property("cmake_target_name", "MySuperPkg1") cpp_info.set_property("cmake_file_name", "ComplexFileName1") else: cpp_info.names["cmake_find_package_multi"] = "GlobakPkgName1" cpp_info.components["mycomp"].names[ "cmake_find_package_multi"] = "MySuperPkg1" cpp_info.filenames["cmake_find_package_multi"] = "ComplexFileName1" conanfile_dep = ConanFile(Mock(), None) conanfile_dep.cpp_info = cpp_info with mock.patch('conans.ConanFile.ref', new_callable=mock.PropertyMock) as mock_ref: with mock.patch('conans.ConanFile.dependencies', new_callable=mock.PropertyMock) as mock_deps: mock_ref.return_value = ConanFileReference.loads( "OriginalDepName/1.0") mock_deps.return_value = Mock() conanfile_dep.package_folder = "/path/to/folder_dep" conanfile.dependencies.transitive_host_requires = [ ConanFileInterface(conanfile_dep) ] conanfile.dependencies.host_requires = [ ConanFileInterface(conanfile_dep) ] cmakedeps = CMakeDeps(conanfile) files = cmakedeps.content assert "TARGET GlobakPkgName1::MySuperPkg1" in files[ "ComplexFileName1Config.cmake"] assert 'set(GlobakPkgName1_INCLUDE_DIRS_DEBUG "${GlobakPkgName1_PACKAGE_FOLDER}/include")' \ in files["ComplexFileName1-debug-x64-data.cmake"] assert 'set(GlobakPkgName1_MySuperPkg1_INCLUDE_DIRS_DEBUG ' \ '"${GlobakPkgName1_PACKAGE_FOLDER}/include")' \ in files["ComplexFileName1-debug-x64-data.cmake"]
def setUp(self): settings = Settings() self.profile = Profile() self.profile._settings = settings self.profile._user_options = None self.profile._env_values = None self.profile._dev_reference = None self.profile._package_settings = None self.conanfile_path = os.path.join(temp_folder(), "conanfile.py") output = TestBufferConanOutput() self.loader = ConanFileLoader(None, output, ConanPythonRequire(None, None))
def setUpClass(cls): env = EnvValues() env.add("USER_FLAG", "user_value") env.add("CL", ["cl1", "cl2"]) env.add("PATH", ["another_path", ]) env.add("PATH2", ["p1", "p2"]) conanfile = ConanFile(TestBufferConanOutput(), None) conanfile.initialize(Settings({}), env) cls.generator = VirtualEnvGenerator(conanfile) cls.generator.output_path = "not-used" cls.result = cls.generator.content