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('')
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 ''
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 ""
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
def open(*args, **kwargs): """Open object in current session.""" return nemoa.open(*args, **kwargs)
def execute(project, script, kwargs): nemoa.welcome() workspace = nemoa.open(project) workspace.execute(name=script, arguments=kwargs)
def test_workspace_open(self): nemoa.open('testsuite') test = nemoa.get('workspace') == 'testsuite' self.assertTrue(test)
def run_script(workspace, script, *args): """Run nemoa python script.""" import nemoa return nemoa.open(workspace) and nemoa.run(script, *args)
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
def tearDown(self): # open previous workspace if nemoa.get('workspace') != self.workspace: nemoa.open(self.workspace) nemoa.set('mode', self.mode)
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')
def run_script(workspace: str, script: str, *args: Any) -> bool: """Run nemoa python script.""" return nemoa.open(workspace) and nemoa.run(script, *args)