Beispiel #1
0
    class Simple(Anod):

        test_qualifier_format = (("with_bar", False), )

        build_source_list = [
            Anod.Source("foo-src", publish=False),
            Anod.Source("bar-src", publish=True),
        ]

        @property
        def test_source_list(self):
            result = [Anod.Source("foo-test-src", publish=False)]
            if self.parsed_qualifier.get("with_bar"):
                result.append(Anod.Source("bar-test-src", publish=False))
            return result
Beispiel #2
0
def test_spec_wrong_dep():
    """Check exception message when wrong dependency is set."""
    with pytest.raises(SpecError) as err:
        Anod.Dependency("foo", require="invalid")

    assert ("require should be build_tree, installation or source_pkg not "
            "invalid" in str(err))
Beispiel #3
0
    class MySpec(Anod):

        build_deps = [Anod.BuildVar("key", "value")]

        @Anod.primitive()
        def build(self):
            pass
Beispiel #4
0
    class MySpec(Anod):

        build_deps = [Anod.BuildVar('key', 'value')]

        @Anod.primitive()
        def build(self):
            pass
Beispiel #5
0
def test_custom_repr():
    """Test yaml custom repr for Make."""
    Anod.sandbox = SandBox()
    Anod.sandbox.root_dir = os.getcwd()
    Anod.sandbox.create_dirs()

    ac = Anod(qualifier='', kind='build', jobs=1)
    AnodDriver(anod_instance=ac, store=None).activate(Anod.sandbox, None)

    m = Make(ac, exec_dir='/here', makefile='/tmp/makefile')
    AnodDriver(anod_instance=ac, store=None).activate(Anod.sandbox, None)
    ac.build_space.create()
    assert "cmd: [make, -f, /tmp/makefile, -j, '1']" in yaml.dump(m)
Beispiel #6
0
    class WithPrimitive(Anod):

        build_qualifier_format = (("error", False),)

        package = Anod.Package(prefix="mypackage", version=lambda: "42")

        @Anod.primitive()
        def build(self):
            if "error" in self.parsed_qualifier:
                raise ValueError(self.parsed_qualifier["error"])
            elif "error2" in self.parsed_qualifier:
                self.shell(sys.executable, "-c", "import sys; sys.exit(2)")
            else:
                hello = self.shell(
                    sys.executable, "-c", 'print("world")', output=subprocess.PIPE
                )
                return hello.out.strip()
Beispiel #7
0
    class WithPrimitive(Anod):

        build_qualifier_format = (('error', False), )

        package = Anod.Package(prefix='mypackage', version=lambda: '42')

        @Anod.primitive()
        def build(self):
            if 'error' in self.parsed_qualifier:
                raise ValueError(self.parsed_qualifier['error'])
            elif 'error2' in self.parsed_qualifier:
                self.shell(sys.executable, '-c', 'import sys; sys.exit(2)')
            else:
                hello = self.shell(sys.executable,
                                   '-c',
                                   'print("world")',
                                   output=subprocess.PIPE)
                return hello.out.strip()
Beispiel #8
0
 def test_source_list(self):
     result = [Anod.Source("foo-test-src", publish=False)]
     if self.parsed_qualifier.get("with_bar"):
         result.append(Anod.Source("bar-test-src", publish=False))
     return result