本文整理匯總了Python中conans.model.settings.Settings.remove方法的典型用法代碼示例。如果您正苦於以下問題:Python Settings.remove方法的具體用法?Python Settings.remove怎麽用?Python Settings.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類conans.model.settings.Settings
的用法示例。
在下文中一共展示了Settings.remove方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: SettingsTest
# 需要導入模塊: from conans.model.settings import Settings [as 別名]
# 或者: from conans.model.settings.Settings import remove [as 別名]
class SettingsTest(unittest.TestCase):
def setUp(self):
data = {"compiler": {
"Visual Studio": {
"version": ["10", "11", "12"],
"runtime": ["MD", "MT"]},
"gcc": {
"version": ["4.8", "4.9"],
"arch": {"x86": {"speed": ["A", "B"]},
"x64": {"speed": ["C", "D"]}}}
},
"os": ["Windows", "Linux"]}
self.sut = Settings(data)
def test_in_contains(self):
self.sut.compiler = "Visual Studio"
self.assertTrue("Visual" in self.sut.compiler)
self.assertFalse("Visual" not in self.sut.compiler)
def test_os_split(self):
settings = Settings.loads("""os:
Windows:
Linux:
Macos:
version: [1, 2]
Android:
""")
other_settings = Settings.loads("os: [Windows, Linux]")
settings.os = "Windows"
other_settings.os = "Windows"
self.assertEqual(settings.values.sha, other_settings.values.sha)
def any_test(self):
data = {"target": "ANY"}
sut = Settings(data)
sut.target = "native"
self.assertTrue(sut.target == "native")
def multi_os_test(self):
settings = Settings.loads("""os:
Windows:
Linux:
distro: [RH6, RH7]
Macos:
codename: [Mavericks, Yosemite]
""")
settings.os = "Windows"
self.assertEqual(settings.os, "Windows")
settings.os = "Linux"
settings.os.distro = "RH6"
self.assertTrue(settings.os.distro == "RH6")
with self.assertRaises(ConanException):
settings.os.distro = "Other"
with self.assertRaises(ConanException):
settings.os.codename = "Yosemite"
settings.os = "Macos"
settings.os.codename = "Yosemite"
self.assertTrue(settings.os.codename == "Yosemite")
def remove_test(self):
self.sut.remove("compiler")
self.sut.os = "Windows"
self.sut.validate()
self.assertEqual(self.sut.values.dumps(), "os=Windows")
def remove_compiler_test(self):
self.sut.compiler.remove("Visual Studio")
with self.assertRaises(ConanException) as cm:
self.sut.compiler = "Visual Studio"
self.assertEqual(str(cm.exception),
bad_value_msg("settings.compiler", "Visual Studio", ["gcc"]))
def remove_version_test(self):
self.sut.compiler["Visual Studio"].version.remove("12")
self.sut.compiler = "Visual Studio"
with self.assertRaises(ConanException) as cm:
self.sut.compiler.version = "12"
self.assertEqual(str(cm.exception),
bad_value_msg("settings.compiler.version", "12", ["10", "11"]))
self.sut.compiler.version = 11
self.assertEqual(self.sut.compiler.version, "11")
def remove_os_test(self):
self.sut.os.remove("Windows")
with self.assertRaises(ConanException) as cm:
self.sut.os = "Windows"
self.assertEqual(str(cm.exception),
bad_value_msg("settings.os", "Windows", ["Linux"]))
self.sut.os = "Linux"
self.assertEqual(self.sut.os, "Linux")
def loads_default_test(self):
settings = Settings.loads("""os: [Windows, Linux, Macos, Android, FreeBSD, SunOS]
arch: [x86, x86_64, arm]
compiler:
sun-cc:
version: ["5.10", "5.11", "5.12", "5.13", "5.14"]
gcc:
version: ["4.8", "4.9", "5.0"]
#.........這裏部分代碼省略.........