示例#1
0
文件: cli.py 项目: fishroot/nemoa
def print_scripts(workspace: str) -> None:
    """Print list of scripts to standard output."""
    nemoa.set('mode', 'silent')

    if nemoa.open(workspace):
        ui.info('Scripts in workspace %s:\n' % (nemoa.get('workspace')))
        for script in nemoa.list('scripts'):
            ui.info('    %s' % (script))
        ui.info('')
示例#2
0
文件: cli.py 项目: fishroot/nemoa
def print_scripts(workspace: str) -> None:
    """Print list of scripts to standard output."""
    nemoa.set('mode', 'silent')

    if nemoa.open(workspace):
        ui.info('Scripts in workspace %s:\n' % (nemoa.get('workspace')))
        for script in nemoa.list('scripts'):
            ui.info('    %s' % (script))
        ui.info('')
示例#3
0
def scripts(project):
    """Print list of scripts to standard output."""
    logParams = nemoa.getLog()
    nemoa.setLog(mode='silent')
    workspace = nemoa.open(project)
    nemoa.setLog(mode=logParams['mode'])
    scripts = workspace.list(type='script', namespace=workspace.project())
    print 'Scripts in project %s:\n' % (project)
    for script in scripts:
        print '    %s' % (script)
    print ''
示例#4
0
def scripts(project):
    """Print list of scripts to standard output."""
    logParams = nemoa.getLog()
    nemoa.setLog(mode="silent")
    workspace = nemoa.open(project)
    nemoa.setLog(mode=logParams["mode"])
    scripts = workspace.list(type="script", namespace=workspace.project())
    print "Scripts in project %s:\n" % (project)
    for script in scripts:
        print "    %s" % (script)
    print ""
示例#5
0
    def print_scripts(workspace):
        """Print list of scripts to standard output."""

        import nemoa

        nemoa.set('mode', 'silent')
        if not nemoa.open(workspace): return False
        print(('Scripts in workspace %s:\n' % (nemoa.get('workspace'))))
        for script in nemoa.list('scripts'):
            print(('    %s' % (script)))
        print()

        return True
示例#6
0
 def open(*args, **kwargs):
     """Open object in current session."""
     return nemoa.open(*args, **kwargs)
示例#7
0
def execute(project, script, kwargs):
    nemoa.welcome()
    workspace = nemoa.open(project)
    workspace.execute(name=script, arguments=kwargs)
示例#8
0
def execute(project, script, kwargs):
    nemoa.welcome()
    workspace = nemoa.open(project)
    workspace.execute(name=script, arguments=kwargs)
示例#9
0
 def test_workspace_open(self):
     nemoa.open('testsuite')
     test = nemoa.get('workspace') == 'testsuite'
     self.assertTrue(test)
示例#10
0
    def run_script(workspace, script, *args):
        """Run nemoa python script."""

        import nemoa

        return nemoa.open(workspace) and nemoa.run(script, *args)
示例#11
0
    def run_unittest():
        """Run unittest."""

        import nemoa
        import unittest

        # initialize loader and test suite
        loader = unittest.TestLoader()
        suite = unittest.TestSuite()

        # open workspace 'testsuite'
        workspace = nemoa.get('workspace')
        nemoa.open('testsuite', base='site')

        # add tests to the test suite
        try:
            import nemoa.common.__test__
        except ImportError:
            pass
        else:
            suite.addTests(loader.loadTestsFromModule(nemoa.common.__test__))
        try:
            import nemoa.workspace.__test__
        except ImportError:
            pass
        else:
            suite.addTests(loader.loadTestsFromModule(
                nemoa.workspace.__test__))
        try:
            import nemoa.session.__test__
        except ImportError:
            pass
        else:
            suite.addTests(loader.loadTestsFromModule(nemoa.session.__test__))
        try:
            import nemoa.dataset.__test__
        except ImportError:
            pass
        else:
            suite.addTests(loader.loadTestsFromModule(nemoa.dataset.__test__))
        try:
            import nemoa.network.__test__
        except ImportError:
            pass
        else:
            suite.addTests(loader.loadTestsFromModule(nemoa.network.__test__))
        try:
            import nemoa.system.__test__
        except ImportError:
            pass
        else:
            suite.addTests(loader.loadTestsFromModule(nemoa.system.__test__))
        try:
            import nemoa.model.__test__
        except ImportError:
            pass
        else:
            suite.addTests(loader.loadTestsFromModule(nemoa.model.__test__))

        # initialize runner
        runner = unittest.TextTestRunner(verbosity=2)

        # run testsuite
        nemoa.log('testing nemoa ' + nemoa.__version__)
        result = runner.run(suite)

        # open previous workspace
        if nemoa.get('workspace') != workspace: nemoa.open(workspace)

        return result
示例#12
0
 def tearDown(self):
     # open previous workspace
     if nemoa.get('workspace') != self.workspace:
         nemoa.open(self.workspace)
     nemoa.set('mode', self.mode)
示例#13
0
 def setUp(self):
     self.mode = nemoa.get('mode')
     self.workspace = nemoa.get('workspace')
     nemoa.set('mode', 'silent')
     # open workspace 'testsuite'
     nemoa.open('testsuite', base='site')
示例#14
0
文件: cli.py 项目: fishroot/nemoa
def run_script(workspace: str, script: str, *args: Any) -> bool:
    """Run nemoa python script."""
    return nemoa.open(workspace) and nemoa.run(script, *args)
示例#15
0
文件: cli.py 项目: fishroot/nemoa
def run_script(workspace: str, script: str, *args: Any) -> bool:
    """Run nemoa python script."""
    return nemoa.open(workspace) and nemoa.run(script, *args)