当前位置: 首页>>代码示例>>Python>>正文


Python cli.CLI类代码示例

本文整理汇总了Python中omero.cli.CLI的典型用法代码示例。如果您正苦于以下问题:Python CLI类的具体用法?Python CLI怎么用?Python CLI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CLI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, *args, **kwargs):
     self.__output = []
     self.__error = []
     self.__popen = []
     self.__call = []
     self.mox = mox.Mox()
     CLI.__init__(self, *args, **kwargs)
开发者ID:DonaldMacDonald,项目名称:openmicroscopy,代码行数:7,代码来源:mocks.py

示例2: TestJvmCfg

class TestJvmCfg(object):
    """Test template files regeneration"""

    @pytest.fixture(autouse=True)
    def setup_method(self, tmpadmindir):
        self.cli = CLI()
        self.cli.register("admin", AdminControl, "TEST")
        self.cli.register("config", PrefsControl, "TEST")
        self.args = ["admin", "jvmcfg"]
        self.cli.dir = path(tmpadmindir)

    def testNoTemplatesGeneration(self):
        """Test no template files are generated by the jvmcfg subcommand"""

        # Test non-existence of configuration files
        for f in GRID_FILES:
            assert not os.path.exists(path(self.cli.dir) / "etc" / "grid" / f)
        for f in ETC_FILES:
            assert not os.path.exists(path(self.cli.dir) / "etc" / f)

        # Call the jvmcf command and test file genearation
        self.cli.invoke(self.args, strict=True)
        for f in GRID_FILES:
            assert not os.path.exists(path(self.cli.dir) / "etc" / "grid" / f)
        for f in ETC_FILES:
            assert not os.path.exists(path(self.cli.dir) / "etc" / f)

    @pytest.mark.parametrize("suffix", ["", ".blitz", ".indexer", ".pixeldata", ".repository"])
    def testInvalidJvmCfgStrategy(self, suffix, tmpdir):
        """Test invalid JVM strategy configuration leads to CLI error"""

        key = "omero.jvmcfg.strategy%s" % suffix
        self.cli.invoke(["config", "set", key, "bad"], strict=True)
        with pytest.raises(NonZeroReturnCode):
            self.cli.invoke(self.args, strict=True)
开发者ID:kok26th,项目名称:openmicroscopy,代码行数:35,代码来源:test_admin.py

示例3: testParametersParsedCorrectly

 def testParametersParsedCorrectly(self):
     class TestControl(BaseControl):
         def __call__(self2, args):
             self.assertEquals("b",args["a"])
     cli = CLI()
     cli.register("test", TestControl, "HELP")
     cli.invoke(["test","a=b"])
     self.assertEquals(0, cli.rv)
开发者ID:DonaldMacDonald,项目名称:openmicroscopy,代码行数:8,代码来源:cli.py

示例4: T

 class T(Thread):
     def run(self, *args):
         pause = random.random()
         event.wait(pause)
         self.cli = CLI()
         self.cli.loadplugins()
         self.con = self.cli.controls["admin"]
         self.cmp = self.con.ctx
开发者ID:sbesson,项目名称:openmicroscopy,代码行数:8,代码来源:test_cli.py

示例5: testLineParsedCorrectly

 def testLineParsedCorrectly(self):
     class TestControl(BaseControl):
         def __call__(self, args):
             if len(*args) != 2:
                 raise Exc("Args was over parsed! %s" % args)
     cli = CLI()
     cli.register("test", TestControl, "HELP")
     cli.invoke(["test","a","a b c d e"])
     self.assertEquals(0, cli.rv)
开发者ID:DonaldMacDonald,项目名称:openmicroscopy,代码行数:9,代码来源:cli.py

示例6: __init__

 def __init__(self, *args, **kwargs):
     CLI.__init__(self, *args, **kwargs)
     self.DIR = create_path(folder=True)
     self.REQRESP = {}
     self.STORE = MyStore(self.DIR)
     self.STORE.clear(testhost, testuser)
     self.register("s", SessionsControl, "TEST")
     self.controls["s"].FACTORY = lambda ignore: self.STORE
     assert self.STORE.count(testhost, testuser) == 0
开发者ID:DonaldMacDonald,项目名称:openmicroscopy,代码行数:9,代码来源:sess.py

示例7: testNoArgumentsDies

    def testNoArgumentsDies(self):
        cli = CLI()
        cli.register("import", ImportControl, "HELP")

        try:
            cli.invoke([])
            self.assert_(cli.rv != 0)
        except NonZeroReturnCode, nzrc:
            pass
开发者ID:DonaldMacDonald,项目名称:openmicroscopy,代码行数:9,代码来源:import.py

示例8: TestChgrp

class TestChgrp(object):

    def setup_method(self, method):
        self.cli = CLI()
        self.cli.register("chgrp", ChgrpControl, "TEST")
        self.args = ["chgrp"]

    def testHelp(self):
        self.args += ["-h"]
        self.cli.invoke(self.args, strict=True)
开发者ID:Daniel-Walther,项目名称:openmicroscopy,代码行数:10,代码来源:test_chgrp.py

示例9: AbstractCLITest

class AbstractCLITest(ITest):

    def setup_method(self, method):
        super(AbstractCLITest, self).setup_method(method)
        self.cli = CLI()
        self.cli.register("sessions", SessionsControl, "TEST")

    def setup_mock(self):
        self.mox = Mox()

    def teardown_mock(self):
        self.mox.UnsetStubs()
        self.mox.VerifyAll()
开发者ID:emilroz,项目名称:openmicroscopy,代码行数:13,代码来源:cli.py

示例10: check

    def check(self):

        from omero.cli import CLI
        from omero.gateway import BlitzGateway

        cli = CLI()
        cli.loadplugins()
        cli.onecmd('login -q')

        try:
            gateway = BlitzGateway(client_obj=cli.get_client())
            for experiment in self.m["experiments"]:
                self.check_object(gateway, experiment, "Project")
            for experiment in self.m["screens"]:
                self.check_object(gateway, experiment, "Screen")
            if "map" in self.m:
                if self.m["experiments"]:
                    study_type = "Project"
                else:
                    study_type = "Screen"
                self.check_object(gateway, self.m, study_type)
        finally:
            if cli:
                cli.close()
            gateway.close()
开发者ID:IDR,项目名称:idr-metadata,代码行数:25,代码来源:study_parser.py

示例11: setup_method

    def setup_method(self, method):
        self.cli = CLI()
        self.cli.register("db", DatabaseControl, "TEST")

        dir = path(__file__) / ".." / ".." / ".." / ".." / ".." / ".." /\
            ".." / "dist"  # FIXME: should not be hard-coded
        dir = dir.abspath()
        cfg = dir / "etc" / "omero.properties"
        cfg = cfg.abspath()
        self.cli.dir = dir

        self.data = {}
        for line in cfg.text().split("\n"):
            line = line.strip()
            for x in ("version", "patch"):
                key = "omero.db." + x
                if line.startswith(key):
                    self.data[x] = line[len(key)+1:]

        self.file = create_path()
        self.script_file = "%(version)s__%(patch)s.sql" % self.data
        if os.path.isfile(self.script_file):
            os.rename(self.script_file, self.script_file + '.bak')
        assert not os.path.isfile(self.script_file)

        self.mox = Mox()
        self.mox.StubOutWithMock(getpass, 'getpass')
        self.mox.StubOutWithMock(__builtin__, "raw_input")
开发者ID:emilroz,项目名称:openmicroscopy,代码行数:28,代码来源:test_db.py

示例12: setup_method

    def setup_method(self, method):
        # # Non-temp directories
        ctxdir = path() / ".." / ".." / ".." / "dist"
        etc_dir = ctxdir / "etc"

        # List configuration files to backup
        self.cfg_files = {}
        for f in ['internal.cfg', 'master.cfg', 'ice.config']:
            self.cfg_files[f] = etc_dir / f
        for f in ['windefault.xml', 'default.xml', 'config.xml']:
            self.cfg_files[f] = etc_dir / 'grid' / f

        # Create temp files for backup
        tmp_dir = create_path(folder=True)
        self.tmp_cfg_files = {}
        for key in self.cfg_files.keys():
            if self.cfg_files[key].exists():
                self.tmp_cfg_files[key] = tmp_dir / key
                self.cfg_files[key].copy(self.tmp_cfg_files[key])
            else:
                self.tmp_cfg_files[key] = None

        # Other setup
        self.cli = CLI()
        self.cli.dir = ctxdir
        self.cli.register("admin", AdminControl, "TEST")
        self.args = ["admin", "ports"]
开发者ID:stelfrich,项目名称:openmicroscopy,代码行数:27,代码来源:test_admin.py

示例13: TestHql

class TestHql(object):

    def setup_method(self, method):
        self.cli = CLI()
        self.cli.register("hql", HqlControl, "TEST")
        self.args = ["hql"]

    def testHelp(self):
        self.args += ["-h"]
        self.cli.invoke(self.args, strict=True)

    @pytest.mark.parametrize("key", BLACKLISTED_KEYS)
    def testFilterBlacklist(self, key):
        output = self.cli.controls["hql"].filter({key: 1})
        assert output == {}

    @pytest.mark.parametrize("key", ["rois", "groupExperimenterMap"])
    def testFilterLoaded(self, key):
        output = self.cli.controls["hql"].filter({"_" + key + "Loaded": 1})
        assert output == {}

    @pytest.mark.parametrize(
        ("value", "outcome"),
        [("owner=None;group=None", {}),
         ("owner=1", {"details": "owner=1"})])
    def testFilterDetails(self, value, outcome):
        output = self.cli.controls["hql"].filter({"_details": value})
        assert output == outcome

    @pytest.mark.parametrize("multi_value", [[0, 1]])
    def testFilterMultiValue(self, multi_value):
        output = self.cli.controls["hql"].filter({'key': multi_value})
        assert output == {}

    @pytest.mark.parametrize("empty_value", [None, [], {}])
    def testFilterEmptyValue(self, empty_value):
        output = self.cli.controls["hql"].filter({'key': empty_value})
        assert output == {}

    @pytest.mark.parametrize("value", WHITELISTED_VALUES)
    def testFilterWhitelist(self, value):
        output = self.cli.controls["hql"].filter({'key': value})
        assert output == {'key': value}

    def testFilterStrip(self):
        output = self.cli.controls["hql"].filter({'_key': 1})
        assert output == {'key': 1}
开发者ID:Daniel-Walther,项目名称:openmicroscopy,代码行数:47,代码来源:test_hql.py

示例14: testDropBoxArgs

    def testDropBoxArgs(self):
        class MockImportControl(ImportControl):
            def importer(this, args):
                self.assertEquals(args.server, "localhost")
                self.assertEquals(args.port, "4064")
                self.assertEquals(args.key, "b0742975-03a1-4f6d-b0ac-639943f1a147")
                self.assertEquals(args.errs, "/Users/cblackburn/omero/tmp/omero_cblackburn/6915/dropboxuUGl5rerr")
                self.assertEquals(args.file, "/Users/cblackburn/omero/tmp/omero_cblackburn/6915/dropboxaDCjQlout")

        cmd = ['-s', 'localhost', '-p', '4064', '-k', 'b0742975-03a1-4f6d-b0ac-639943f1a147']
        cmd += ['import', '---errs=/Users/cblackburn/omero/tmp/omero_cblackburn/6915/dropboxuUGl5rerr']
        cmd += ['---file=/Users/cblackburn/omero/tmp/omero_cblackburn/6915/dropboxaDCjQlout']
        cmd += ['--', '/OMERO/DropBox/root/tinyTest.d3d.dv']

        cli = CLI()
        cli.register("import", MockImportControl, "HELP")
        cli.invoke(cmd)
开发者ID:DonaldMacDonald,项目名称:openmicroscopy,代码行数:17,代码来源:import.py

示例15: setup_method

 def setup_method(self, method):
     self.cli = CLI()
     self.cli.register("import", ImportControl, "TEST")
     self.args = ["import"]
     dist_dir = path(__file__) / ".." / ".." / ".." / ".." / ".." / ".." /\
         ".." / "dist"  # FIXME: should not be hard-coded
     dist_dir = dist_dir.abspath()
     client_dir = dist_dir / "lib" / "client"
     self.args += ["--clientdir", client_dir]
开发者ID:sbesson,项目名称:openmicroscopy,代码行数:9,代码来源:test_import.py


注:本文中的omero.cli.CLI类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。