Add a test to check the mixed _build warning
@@ -13,6 +13,44 @@ from conans.test.utils.tools import TestClient, TestServer, TurboTestClient
from conans.util.files import load, save
+class ExportTest(unittest.TestCase):
+
+ def export_warning_test(self):
+ mixed_conanfile = """
+from conans import ConanFile
+
+class HelloConan(ConanFile):
+ name = "Hello"
+ version = "0.1"
+ exports = "*.h", "*.cpp"
+ settings = "os", "os_build"
+ def package(self):
+ self.copy("*.h", "include")
+"""
+
+ client = TestClient()
+ client.save({"conanfile.py": mixed_conanfile})
+ client.run("export . Hello/0.1")
+ self.assertIn("This package defines both 'os' and 'os_build'", client.out)
+
+ def export_no_warning_test(self):
+ conanfile = """
+from conans import ConanFile
+
+class HelloConan(ConanFile):
+ name = "Hello"
+ version = "0.1"
+ exports = "*.h", "*.cpp"
+ settings = "os"
+ def package(self):
+ self.copy("*.h", "include")
+"""
+ client = TestClient()
+ client.save({"conanfile.py": conanfile})
+ client.run("export . Hello/0.1")
+ self.assertNotIn("This package defines both 'os' and 'os_build'", client.out)
+
+
class ReplaceSCMDataInConanfileTest(unittest.TestCase):
conanfile = """
from conans import ConanFile
@@ -48,7 +86,8 @@ class ConanLib(ConanFile):
scm_data = SCMData(conanfile=namedtuple('_', 'scm')(scm=scm_data))
_replace_scm_data_in_conanfile(self.conanfile_path, scm_data)
self.assertEqual(load(self.conanfile_path), target_conanfile)
- _parse_conanfile(conan_file_path=self.conanfile_path) # Check that the resulting file is valid python code.
+ # Check that the resulting file is valid python code.
+ _parse_conanfile(conan_file_path=self.conanfile_path)
def test_conanfile_after_scm(self):
scm_data = {'type': 'git',
