@@ -88,6 +88,7 @@ def test_conanfile(self):
88
88
self .assertIn ("ERROR: [CONAN CENTER INDEX URL (KB-H027)] The attribute 'url' should " \
89
89
"point to: https://github.com/conan-io/conan-center-index" , output )
90
90
self .assertIn ("[CMAKE MINIMUM VERSION (KB-H028)] OK" , output )
91
+ self .assertIn ("[CUSTOM ATTRIBUTES (KB-H034)] OK" , output )
91
92
92
93
def test_conanfile_header_only (self ):
93
94
tools .save ('conanfile.py' , content = self .conanfile_header_only )
@@ -109,6 +110,7 @@ def test_conanfile_header_only(self):
109
110
"recipe" , output )
110
111
self .assertIn ("[META LINES (KB-H025)] OK" , output )
111
112
self .assertIn ("[CMAKE MINIMUM VERSION (KB-H028)] OK" , output )
113
+ self .assertIn ("[CUSTOM ATTRIBUTES (KB-H034)] OK" , output )
112
114
113
115
def test_conanfile_header_only_with_settings (self ):
114
116
tools .save ('conanfile.py' , content = self .conanfile_header_only_with_settings )
@@ -129,6 +131,7 @@ def test_conanfile_header_only_with_settings(self):
129
131
"recipe" , output )
130
132
self .assertIn ("[META LINES (KB-H025)] OK" , output )
131
133
self .assertIn ("[CMAKE MINIMUM VERSION (KB-H028)] OK" , output )
134
+ self .assertIn ("[CUSTOM ATTRIBUTES (KB-H034)] OK" , output )
132
135
133
136
def test_conanfile_installer (self ):
134
137
tools .save ('conanfile.py' , content = self .conanfile_installer )
@@ -397,3 +400,30 @@ def test_cmake_minimum_version(self):
397
400
self .assertIn ("ERROR: [CMAKE MINIMUM VERSION (KB-H028)] The CMake file '%s' must contain a "
398
401
"minimum version declared (e.g. cmake_minimum_required(VERSION 3.1.2))" % path ,
399
402
output )
403
+
404
+ def test_invalid_recipe_attributes (self ):
405
+ conanfile = textwrap .dedent ("""\
406
+ from conans import ConanFile
407
+
408
+ class AConan(ConanFile):
409
+ url = "fake_url.com"
410
+ license = "fake_license"
411
+ description = "whatever"
412
+ homepage = "homepage.com"
413
+ topics = ("fake_topic", "another_fake_topic")
414
+ exports_sources = "header.h"
415
+ options = {"foo": [True, False], "bar": [True, False]}
416
+ default_options = {"foo": False, "bar": True}
417
+ _source_subfolder = "source_subfolder"
418
+ _build_subfolder = "build_subfolder"
419
+ foobar = "package"
420
+ package_subfolder = "package"
421
+
422
+ def package(self):
423
+ self.copy("*", dst="include")
424
+ """ )
425
+ tools .save ('conanfile.py' , content = conanfile )
426
+ output = self .conan (['create' , '.' , 'name/version@user/test' ])
427
+ self .assertIn ("ERROR: [CUSTOM ATTRIBUTES (KB-H034)] Custom attributes must be declared " \
428
+ "as protected. The follow attributes are invalid: 'foobar', " \
429
+ "'package_subfolder'" , output )
0 commit comments