Ejemplo n.º 1
0
 def test_basic_pool(self):
     pool = CFDPool()
     sample_class = object
     pool.register(sample_class)
     with self.assertRaises(AlreadyRegisteredException):
         pool.register(sample_class)
Ejemplo n.º 2
0
import subprocess
from cfd.pool import CFDPool

package_manager_registry = CFDPool()


class CFDPackageManager(object):
    def latest_version(self, package):
        """
        Show the latest version for `package`
        """
        raise Exception("Please define an latest_version method on your package manager %s" % self.__class__.__name__)

    def list_installed_packages(self):
        """
        List all installed packages
        """
        raise Exception("Please define an list_packages method on your package manager %s" % self.__class__.__name__)

    def version(self, package):
        """
        Return package version or None if not installed
        """
        raise Exception("Please define an version method on your package manager %s" % self.__class__.__name__)

    def install(self, package, version=None):
        """
        Install a package, optionally a specific version
        """
        raise Exception("Please define an install method on your package manager %s" % self.__class__.__name__)