Example #1
0
    def test_00_list_plugin_modules__w_pluginsdir(self):
        srcs = glob.glob(
            os.path.join(TC.selfdir(), MP.PLUGINS_FILENAME_PATTERN)
        )
        dst = os.path.join(self.workdir, MP.PLUGINS_SUBDIR)

        if not os.path.exists(dst):
            os.makedirs(dst)

        for f in srcs:
            shutil.copy(f, dst)

        basenames = sorted(
            os.path.basename(os.path.splitext(f)[0]) for f in srcs
        )

        self.assertEquals(sorted(MP.list_plugin_modules(dst)), basenames)
Example #2
0
    def test_20_load_plugin_modules__w_plugdir(self):
        srcs = glob.glob(
            os.path.join(TC.selfdir(), MP.PLUGINS_FILENAME_PATTERN)
        )
        dst = os.path.join(self.workdir, MP.PLUGINS_SUBDIR)

        if not os.path.exists(dst):
            os.makedirs(dst)

        for f in srcs:
            shutil.copy(f, dst)

        modnames = sorted(
            os.path.basename(os.path.splitext(f)[0]) for f in srcs
        )

        ms = MP.load_plugin_modules(dst, MP.PLUGINS_FILENAME_PATTERN)

        for n, m in itertools.izip(modnames, ms):
            self.assertEquals(n, m.__name__)
Example #3
0
def get_module(name="00_plugin", mdir=TC.selfdir()):
    return P._load_module(name, os.path.join(mdir, "../plugins/tests"))