diff --git a/recipes/catch2/2.x.x/conanfile.py b/recipes/catch2/2.x.x/conanfile.py index 8a6380c67def4..a01036512b907 100644 --- a/recipes/catch2/2.x.x/conanfile.py +++ b/recipes/catch2/2.x.x/conanfile.py @@ -46,7 +46,7 @@ def configure(self): self.options.rm_safe("with_benchmark") def package_id(self): - if not self.options.with_main: + if not self.info.options.with_main: self.info.clear() def layout(self): @@ -55,7 +55,7 @@ def layout(self): def validate(self): if Version(self.version) < "2.13.1" and self.settings.arch == "armv8": raise ConanInvalidConfiguration("ARMv8 is not supported by versions < 2.13.1+") - if self.options.with_main and Version(self.version) < "2.13.4": + if self.info.options.get_safe("with_main") and Version(self.version) < "2.13.4": raise ConanInvalidConfiguration("Option with_main not supported by versions < 2.13.4") def source(self): diff --git a/recipes/catch2/2.x.x/test_package/conanfile.py b/recipes/catch2/2.x.x/test_package/conanfile.py index 716d02299a708..c0784d1e5a53b 100644 --- a/recipes/catch2/2.x.x/test_package/conanfile.py +++ b/recipes/catch2/2.x.x/test_package/conanfile.py @@ -3,6 +3,7 @@ from conan.tools.build import can_run from conan.tools.cmake import cmake_layout import os +import yaml class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" @@ -11,6 +12,10 @@ class TestPackageConan(ConanFile): _tests_todo = [] + @property + def _todos_filename(self): + return os.path.join(self.recipe_folder, self.folders.test_output, self.folders.generators,"catch2_test_to_do.yml") + def requirements(self): self.requires(self.tested_reference_str) @@ -29,6 +34,9 @@ def generate(self): if not catch_opts.with_prefix and catch_opts.with_main and catch_opts.with_benchmark: self._tests_todo.append("benchmark") + with open(self._todos_filename, "w") as file: + yaml.dump(self._tests_todo, file) + def layout(self): cmake_layout(self) @@ -38,6 +46,8 @@ def build(self): cmake.build() def test(self): + with open(self._todos_filename, "r") as file: + self._tests_todo = yaml.safe_load(file) if can_run(self): for test_name in self._tests_todo: self.run(os.path.join(self.cpp.build.bindirs[0], test_name), env="conanrun")