Пример #1
0
    def test_load_plugin_types(self):
        """
        Test if load_plugin_types loads correct classes
        """

        types = load_plugin_types(Base)
        self.assertIn('sub', types)
        self.assertIs(issubclass(types['sub'], Base), True)
Пример #2
0
    def test_load_plugin_types(self):
        """
        Test if load_plugin_types loads correct classes
        """

        types = load_plugin_types(Base)
        self.assertIn('sub', types)
        self.assertIs(issubclass(types['sub'], Base), True)
Пример #3
0
        super(Repo, self).__init__()

    def list_packages(self, architectures) -> None:
        """
        Return list of packages available in this repository.
        """

        raise NotImplementedError

    @property
    def cache_lifetime(self):
        """
        Return the lifetime of the repository metadata cache in seconds.
        """

        raise NotImplementedError

    @cache_lifetime.setter
    def cache_lifetime(self, lifetime):
        """
        Set the lifetime of the repository metadata cache in seconds.
        Negative values are interpreted as “never expire” and 0 circumvents the
        cache altogether.
        """

        raise NotImplementedError


import_dir(__name__, os.path.dirname(__file__))
load_plugin_types(Repo, repo_types)
Пример #4
0

class Repo(Plugin):
    """
    A common superclass for repository plugins.
    """

    def __init__(self, *args, **kwargs):
        """
        The superclass constructor does not really need to be called, but it
        enables a few useful features (like unified logging). If not called
        by the child, it just makes sure that Repo class is not instantiated
        directly.
        """

        if self.__class__.__name__ == "Repo":
            raise FafError("You need to subclass the Repo class "
                           "in order to implement a repository plugin.")

        super(Repo, self).__init__()

    def list_packages(self):
        """
        Return list of packages available in this repository.
        """

        raise NotImplementedError

import_dir(__name__, os.path.dirname(__file__))
load_plugin_types(Repo, repo_types)