def validate_test(self):
        with self.assertRaisesRegexp(ConanException,
                                     undefined_value("settings.compiler")):
            self.sut.validate()

        self.sut.compiler = "gcc"
        with self.assertRaisesRegexp(
                ConanException, undefined_value("settings.compiler.arch")):
            self.sut.validate()

        self.sut.compiler.arch = "x86"
        with self.assertRaisesRegexp(
                ConanException,
                undefined_value("settings.compiler.arch.speed")):
            self.sut.validate()

        self.sut.compiler.arch.speed = "A"
        with self.assertRaisesRegexp(
                ConanException, undefined_value("settings.compiler.version")):
            self.sut.validate()

        self.sut.compiler.version = "4.8"
        with self.assertRaisesRegexp(ConanException,
                                     undefined_value("settings.os")):
            self.sut.validate()

        self.sut.os = "Windows"
        self.sut.validate()
        self.assertEqual(self.sut.values_list, [("compiler", "gcc"),
                                                ("compiler.arch", "x86"),
                                                ("compiler.arch.speed", "A"),
                                                ("compiler.version", "4.8"),
                                                ("os", "Windows")])
Esempio n. 2
0
    def validate_test(self):
        with self.assertRaisesRegexp(ConanException, undefined_value("settings.compiler")):
            self.sut.validate()

        self.sut.compiler = "gcc"
        with self.assertRaisesRegexp(ConanException, undefined_value("settings.compiler.arch")):
            self.sut.validate()

        self.sut.compiler.arch = "x86"
        with self.assertRaisesRegexp(ConanException,
                                     undefined_value("settings.compiler.arch.speed")):
            self.sut.validate()

        self.sut.compiler.arch.speed = "A"
        with self.assertRaisesRegexp(ConanException, undefined_value("settings.compiler.version")):
            self.sut.validate()

        self.sut.compiler.version = "4.8"
        with self.assertRaisesRegexp(ConanException, undefined_value("settings.os")):
            self.sut.validate()

        self.sut.os = "Windows"
        self.sut.validate()
        self.assertEqual(self.sut.values_list, [("compiler", "gcc"),
                                           ("compiler.arch", "x86"),
                                           ("compiler.arch.speed", "A"),
                                           ("compiler.version", "4.8"),
                                           ("os", "Windows")])
Esempio n. 3
0
    def validate2_test(self):
        self.sut.os = "Windows"
        self.sut.compiler = "Visual Studio"
        with self.assertRaisesRegexp(ConanException, undefined_value("settings.compiler.runtime")):
            self.sut.validate()

        self.sut.compiler.runtime = "MD"
        with self.assertRaisesRegexp(ConanException, undefined_value("settings.compiler.version")):
            self.sut.validate()

        self.sut.compiler.version = "10"
        self.sut.validate()

        self.assertEqual(self.sut.values_list, [("compiler", "Visual Studio"),
                                            ("compiler.runtime", "MD"),
                                            ("compiler.version", "10"),
                                            ("os", "Windows")])
    def validate2_test(self):
        self.sut.os = "Windows"
        self.sut.compiler = "Visual Studio"
        with self.assertRaisesRegexp(
                ConanException, undefined_value("settings.compiler.runtime")):
            self.sut.validate()

        self.sut.compiler.runtime = "MD"
        with self.assertRaisesRegexp(
                ConanException, undefined_value("settings.compiler.version")):
            self.sut.validate()

        self.sut.compiler.version = "10"
        self.sut.validate()

        self.assertEqual(self.sut.values_list, [("compiler", "Visual Studio"),
                                                ("compiler.runtime", "MD"),
                                                ("compiler.version", "10"),
                                                ("os", "Windows")])
Esempio n. 5
0
    def invalid_settings_test(self):
        '''Test wrong values and wrong constraints'''

        # MISSING VALUE FOR A SETTING
        content = """
from conans import ConanFile

class SayConan(ConanFile):
    name = "Say"
    version = "0.1"
    settings = "os", "build_type"
"""

        self.client.save({CONANFILE: content})
        self.client.run("install --build missing", ignore_error=True)
        self.assertIn(undefined_value("settings.build_type"), str(self.client.user_io.out))
Esempio n. 6
0
    def invalid_settings_test(self):
        '''Test wrong values and wrong constraints'''

        # MISSING VALUE FOR A SETTING
        content = """
from conans import ConanFile

class SayConan(ConanFile):
    name = "Say"
    version = "0.1"
    settings = "os", "build_type"
"""

        self.client.save({CONANFILE: content})
        self.client.run("install --build missing", ignore_error=True)
        self.assertIn(undefined_value("settings.build_type"),
                      str(self.client.user_io.out))