Exemplo n.º 1
0
    def test_load5(self):
        """Test load method"""
        PluginGlobals.add_env("testing.config_loading")

        class TMP2(Plugin):

            def __init__(self):
                declare_option("a")
                declare_option("b", cls=FileOption)
                declare_option("c")
                declare_option("xx", section_re='globals.*')

        config = Configuration()
        tmp2 = TMP2()
        config.load(currdir + "config4.ini")
        #config.pprint()
        if False and sys.platform == "win32":
            #
            # A hack, to ensure cross-platform portability of this test
            #
            e = ExtensionPoint(IFileOption)
            for ep in e.extensions():
                ep.set_value("/dev/null", raw=True)
        #PluginGlobals.pprint()
        config.save(currdir + "config4.out")
        #print config
        self.assertFileEqualsBaseline(
            currdir + "config4.out", currdir + "config4.txt", filter=filter)
        pyutilib.misc.setup_redirect(currdir + "log2.out")
        config.pprint()
        pyutilib.misc.reset_redirect()
        self.assertFileEqualsBaseline(
            currdir + "log2.out", currdir + "log2.txt", filter=filter)
        PluginGlobals.remove_env(
            "testing.config_loading", cleanup=True, singleton=False)
Exemplo n.º 2
0
 def test_save1(self):
     """Test save method"""
     config = Configuration()
     config.load(currdir+"config1.ini")
     #
     # A hack, to ensure cross-platform portability of this test
     #
     if False and sys.platform == "win32":
         e = ExtensionPoint(IFileOption)
         for ep in e.extensions():
             if ep.enabled():
                 ep.set_value("/dev/null", raw=True)
     config.save(currdir+"config1.out")
     #PluginGlobals.pprint()
     self.assertFileEqualsBaseline(currdir+"config1.out",currdir+"config1.txt", filter=filter)
Exemplo n.º 3
0
 def test_save1(self):
     """Test save method"""
     config = Configuration()
     config.load(currdir + "config1.ini")
     #
     # A hack, to ensure cross-platform portability of this test
     #
     if False and sys.platform == "win32":
         e = ExtensionPoint(IFileOption)
         for ep in e.extensions():
             if ep.enabled():
                 ep.set_value("/dev/null", raw=True)
     config.save(currdir + "config1.out")
     #PluginGlobals.pprint()
     self.assertFileEqualsBaseline(currdir + "config1.out",
                                   currdir + "config1.txt",
                                   filter=filter)
Exemplo n.º 4
0
    def test_load5(self):
        """Test load method"""
        PluginGlobals.add_env("testing.config_loading")

        class TMP2(Plugin):
            def __init__(self):
                declare_option("a")
                declare_option("b", cls=FileOption)
                declare_option("c")
                declare_option("xx", section_re='globals.*')

        config = Configuration()
        tmp2 = TMP2()
        config.load(currdir + "config4.ini")
        #config.pprint()
        if False and sys.platform == "win32":
            #
            # A hack, to ensure cross-platform portability of this test
            #
            e = ExtensionPoint(IFileOption)
            for ep in e.extensions():
                ep.set_value("/dev/null", raw=True)
        #PluginGlobals.pprint()
        config.save(currdir + "config4.out")
        #print config
        self.assertFileEqualsBaseline(currdir + "config4.out",
                                      currdir + "config4.txt",
                                      filter=filter)
        pyutilib.misc.setup_redirect(currdir + "log2.out")
        config.pprint()
        pyutilib.misc.reset_redirect()
        self.assertFileEqualsBaseline(currdir + "log2.out",
                                      currdir + "log2.txt",
                                      filter=filter)
        PluginGlobals.remove_env("testing.config_loading",
                                 cleanup=True,
                                 singleton=False)
Exemplo n.º 5
0
def registered_executable(name=None):
    ep = ExtensionPoint(IExternalExecutable)
    if name is None:
        return filter(lambda x: x.name, ep.extensions())
    return ep.service(name)
Exemplo n.º 6
0
def registered_executable(name=None):
    ep = ExtensionPoint(IExternalExecutable)
    if name is None:
        return filter(lambda x: x.name, ep.extensions())
    return ep.service(name)