Esempio n. 1
0
    def test_on_duplicates_raises(self):
        """Test that multiple identical selector sets is an error."""

        with testtools.ExpectedException(
                grammar.errors.GrammarSyntaxError,
                "Invalid grammar syntax: found duplicate 'on amd64,i386' "
                'statements. These should be merged.'):
            grammar.process_grammar(
                self.grammar, snapcraft.ProjectOptions(), self.checker)
Esempio n. 2
0
    def test_on_duplicates_raises(self):
        """Test that multiple identical selector sets is an error."""

        with testtools.ExpectedException(
                grammar.errors.GrammarSyntaxError,
                "Invalid grammar syntax: found duplicate 'on amd64,i386' "
                'statements. These should be merged.'):
            grammar.process_grammar(self.grammar, snapcraft.ProjectOptions(),
                                    self.checker)
Esempio n. 3
0
    def get_stage_packages(self):
        if not self.__stage_packages:
            self.__stage_packages = grammar.process_grammar(
                self._stage_package_grammar, self._project_options,
                self._repo.is_valid)

        return self.__stage_packages
Esempio n. 4
0
    def get_build_snaps(self):
        if not self.__build_snaps:
            self.__build_snaps = grammar.process_grammar(
                self._build_snap_grammar, self._project_options,
                repo.snaps.SnapPackage.is_valid_snap)

        return self.__build_snaps
    def get_build_packages(self):
        if not self.__build_packages:
            self.__build_packages = grammar.process_grammar(
                self._build_package_grammar, self._project_options,
                repo.Repo.build_package_is_valid)

        return self.__build_packages
    def get_stage_packages(self):
        if not self.__stage_packages:
            self.__stage_packages = grammar.process_grammar(
                self._stage_package_grammar, self._project_options,
                self._repo.is_valid)

        return self.__stage_packages
    def get_build_snaps(self):
        if not self.__build_snaps:
            self.__build_snaps = grammar.process_grammar(
                self._build_snap_grammar, self._project_options,
                repo.snaps.SnapPackage.is_valid_snap)

        return self.__build_snaps
    def get_build_packages(self):
        if not self.__build_packages:
            self.__build_packages = grammar.process_grammar(
                self._build_package_grammar, self._project_options,
                repo.Repo.build_package_is_valid)

        return self.__build_packages
Esempio n. 9
0
    def test_basic_grammar(self, platform_machine_mock,
                           platform_architecture_mock):
        platform_machine_mock.return_value = self.host_arch
        platform_architecture_mock.return_value = ('64bit', 'ELF')

        options = snapcraft.ProjectOptions()
        self.assertThat(
            grammar.process_grammar(self.grammar, options, self.checker),
            Equals(self.expected_packages))
Esempio n. 10
0
 def get_source(self):
     if not self.__source:
         # The grammar is array-based, even though we only support a single
         # source.
         source_array = grammar.process_grammar(self._source_grammar,
                                                self._project_options,
                                                lambda s: True)
         if len(source_array) > 0:
             self.__source = source_array.pop()
     return self.__source
Esempio n. 11
0
 def test_invalid_grammar(self):
     with testtools.ExpectedException(
             grammar.errors.GrammarSyntaxError,
             self.expected_exception):
         grammar.process_grammar(
             self.grammar, snapcraft.ProjectOptions(), self.checker)
Esempio n. 12
0
 def test_basic_grammar(self):
     options = snapcraft.ProjectOptions(target_deb_arch=self.target_arch)
     self.assertThat(
         grammar.process_grammar(self.grammar, options, self.checker),
         Equals(self.expected_packages))
Esempio n. 13
0
 def test_invalid_grammar(self):
     with testtools.ExpectedException(grammar.errors.GrammarSyntaxError,
                                      self.expected_exception):
         grammar.process_grammar(self.grammar, snapcraft.ProjectOptions(),
                                 self.checker)
Esempio n. 14
0
 def test_basic_grammar(self):
     options = snapcraft.ProjectOptions(target_deb_arch=self.target_arch)
     self.assertThat(
         grammar.process_grammar(self.grammar, options, self.checker),
         Equals(self.expected_packages))