def test_multiple_with_version(mock_patch_ng): conanfile = ConanFileMock() conanfile.display_name = 'mocked/ref' conanfile.conan_data = { 'patches': { "1.11.0": [{ 'patch_file': 'patches/0001-buildflatbuffers-cmake.patch', 'base_path': 'source_subfolder', }, { 'patch_file': 'patches/0002-implicit-copy-constructor.patch', 'base_path': 'source_subfolder', 'patch_type': 'backport', 'patch_source': 'https://github.com/google/flatbuffers/pull/5650', 'patch_description': 'Needed to build with modern clang compilers.' }], "1.12.0": [ { 'patch_file': 'patches/0001-buildflatbuffers-cmake.patch', 'base_path': 'source_subfolder', }, ] } } with pytest.raises(AssertionError) as excinfo: apply_conandata_patches(conanfile) assert 'Can only be applied if conanfile.version is already defined' == str( excinfo.value) conanfile.version = "1.2.11" apply_conandata_patches(conanfile) assert len(str(conanfile.output)) == 0 conanfile.version = "1.11.0" apply_conandata_patches(conanfile) assert 'Apply patch (backport): Needed to build with modern clang compilers.\n' \ == str(conanfile.output)
def test_multiple_no_version(mock_patch_ng): conanfile = ConanFileMock() conanfile.display_name = 'mocked/ref' conanfile.conan_data = { 'patches': [{ 'patch_file': 'patches/0001-buildflatbuffers-cmake.patch', 'base_path': 'source_subfolder', }, { 'patch_file': 'patches/0002-implicit-copy-constructor.patch', 'base_path': 'source_subfolder', 'patch_type': 'backport', 'patch_source': 'https://github.com/google/flatbuffers/pull/5650', 'patch_description': 'Needed to build with modern clang compilers.' }] } apply_conandata_patches(conanfile) assert 'Apply patch (backport): Needed to build with modern clang compilers.\n' \ == str(conanfile.output)