Run sciunit tests for the given configuration.
766311
def run(config, path=None, stop_on_error=True, just_tests=False):
    """"""
    if path is None:
        path = os.getcwd()
    prep(config, path=path)

    models = __import__('models')
    tests = __import__('tests')
    suites = __import__('suites')

    print('\n')
    for x in ['models', 'tests', 'suites']:
        module = __import__(x)
        assert hasattr(module, x), "'%s' module requires attribute '%s'" %\
                                   (x, x)

    if just_tests:
        for test in tests.tests:
            _run(test, models, stop_on_error)

    else:
        for suite in suites.suites:
            _run(suite, models, stop_on_error)
266090
def run(cmdfile,subsetfile=None, lookupfile=None):
    
    #Define the test case pattern
    pattern="""class %s(basecase.%sCase):
    def setUp(self):
        self.obsmode="%s"
        self.spectrum="%s"
        self.subset=%s
        self.etcid="%s"
        self.setglobal(__file__)
        self.runpy()\n"""

    #Open the (params:etcid) dictionary if it exists
    if lookupfile is not None:
        f=open(lookupfile)
        lookup=pickle.load(f)
        f.close()
    else:
        lookup={}
        
    #Process the subsetfile if present
    subsetflag={}
    if subsetfile is not None:
        #Then this file contains a list of case names that should have a
        #subset flag set.
        f=open(subsetfile)
        for line in f:
            if not line.startswith('#') and len(line.strip())>0:
                cols=line.strip().split()
                subsetflag[cols[0]]=True
        f.close()

    #Open the main input and output files
    f=open(cmdfile)
    out=open(cmdfile.replace('.txt','.py'),'w')
    out.write("""from pytools import testutil
import sys
import basecase
""")

    #Set up some bookkeeping
    count={'countrate':0,'calcspec':0,'calcphot':0,'SpecSourcerateSpec':0,'thermback':0}
    dupcatcher={}
    dupcounter={'countrate':0,'calcspec':0,'calcphot':0,'SpecSourcerateSpec':0,'thermback':0}
    
    #Now start the main loop
    for line in f:
    
    #parse the line
        ktuple=line2ktuple(line)
        cmd,obsmode,spectrum=ktuple
        count[cmd]+=1
        casename="%sCase%d"%(cmd,count[cmd])        
        if ktuple in dupcatcher:
            dupcounter[cmd]+=1
            dupcatcher[ktuple].append(casename)
        else:
            dupcatcher[ktuple]=[casename]
            etcid=lookup.get(ktuple,None)
            if etcid is not None and len(etcid) == 1:
                etcid=etcid[0]
            defn=pattern%(casename,cmd,obsmode,spectrum,subsetflag.get(casename,False),etcid)
            out.write(defn)

    out.write("""\n\n
if __name__ == '__main__':
    if 'debug' in sys.argv:
        testutil.debug(__name__)
    else:
        testutil.testall(__name__,2)
""")

    f.close()

    for k in count:
        total= "#%s:%d - %d dup =%d\n"%(k,count[k],dupcounter[k],count[k]-dupcounter[k])
        sys.stdout.write(total)
        out.write(total)
    out.close()

        
    return dupcatcher
328287
def run():
    """"""

    command = sys.argv[1].strip().lower()
    print('[COMMAND]:', command)

    if command == 'test':
        return run_test()
    elif command == 'build':
        return run_build()
    elif command == 'up':
        return run_container()
    elif command == 'serve':
        import cauldron
        cauldron.run_server(port=5010, public=True)
198484
def run(self):
        

        self.info_log("The test batch is ready.")

        self.executed_tests = []

        for test in self.tests:
            localhost_instance = LocalhostInstance(
                runner=self,
                browser_config=self.browser_config,
                test_name=test.Test.name
            )

            localhost_instance.startup()

            with DbSessionContext(BROME_CONFIG['database']['mongo_database_name']) as session:  # noqa
                test_batch = session.query(Testbatch)\
                    .filter(Testbatch.mongo_id == self.test_batch_id).one()
                test_batch.total_executing_tests = 1
                session.save(test_batch, safe=True)

            test_ = test.Test(
                runner=self,
                browser_config=self.browser_config,
                name=test.Test.name,
                test_batch_id=self.test_batch_id,
                localhost_instance=localhost_instance,
                index=1
            )

            test_.execute()
            self.executed_tests.append(test_)

            localhost_instance.tear_down()
668628
def parse(file_path=None, show=False):
    """"""
    if file_path is None:
        file_path = os.path.join(os.getcwd(), '.sciunit')
    if not os.path.exists(file_path):
        raise IOError('No .sciunit file was found at %s' % file_path)

    # Load the configuration file
    config = configparser.RawConfigParser(allow_no_value=True)
    config.read(file_path)

    # List all contents
    for section in config.sections():
        if show:
            print(section)
        for options in config.options(section):
            if show:
                print("\t%s: %s" % (options, config.get(section, options)))
    return config
1319289
def run(self):
        """"""
        if not self.py_modules and not self.packages:
            return

        if self.py_modules:
            self.build_modules()

        if self.packages:
            self.build_packages()
            self.build_package_data()

        self.run_2to3(self.__updated_files, False)
        self.run_2to3(self.__updated_files, True)
        self.run_2to3(self.__doctests_2to3, True)

        # Only compile actual .py files, using our base class' idea of what our
        # output files are.
        self.byte_compile(orig.build_py.get_outputs(self, include_bytecode=0))
793609
def main(*args):
    """"""
    parser = argparse.ArgumentParser()
    parser.add_argument("action",
                        help="create, check, run, make-nb, or run-nb")
    parser.add_argument("--directory", "-dir", default=os.getcwd(),
                        help="path to directory with a .sciunit file")
    parser.add_argument("--stop", "-s", default=True,
                        help="stop and raise errors, halting the program")
    parser.add_argument("--tests", "-t", default=False,
                        help="runs tests instead of suites")
    if args:
        args = parser.parse_args(args)
    else:
        args = parser.parse_args()
    file_path = os.path.join(args.directory, '.sciunit')
    config = None
    if args.action == 'create':
        create(file_path)
    elif args.action == 'check':
        config = parse(file_path, show=True)
        print("\nNo configuration errors reported.")
    elif args.action == 'run':
        config = parse(file_path)
        run(config, path=args.directory,
            stop_on_error=args.stop, just_tests=args.tests)
    elif args.action == 'make-nb':
        config = parse(file_path)
        make_nb(config, path=args.directory,
                stop_on_error=args.stop, just_tests=args.tests)
    elif args.action == 'run-nb':
        config = parse(file_path)
        run_nb(config, path=args.directory)
    else:
        raise NameError('No such action %s' % args.action)
    if config:
        cleanup(config, path=args.directory)
650139
def run_show_config(args):
    """"""
    # TODO Proposal: remove the "hidden" configuration. Only show config. If
    # the system needs to be configured, then display information on how to
    # configure the system.
    config = copy.deepcopy(bigchaindb.config)
    del config['CONFIGURED']
    print(json.dumps(config, indent=4, sort_keys=True))
343236
function() {
		extend(config, {
			stats: { all: 0, bad: 0 },
			moduleStats: { all: 0, bad: 0 },
			started: +new Date,
			updateRate: 1000,
			blocking: false,
			autostart: true,
			autorun: false,
			filter: "",
			queue: [],
			semaphore: 0
		});

		var tests = id( "qunit-tests" ),
			banner = id( "qunit-banner" ),
			result = id( "qunit-testresult" );

		if ( tests ) {
			tests.innerHTML = "";
		}

		if ( banner ) {
			banner.className = "";
		}

		if ( result ) {
			result.parentNode.removeChild( result );
		}

		if ( tests ) {
			result = document.createElement( "p" );
			result.id = "qunit-testresult";
			result.className = "result";
			tests.parentNode.insertBefore( result, tests );
			result.innerHTML = 'Running...<br/>&nbsp;';
		}
	}
304668
def run(self, **options):
        """"""
        if not self.is_setup:
            self.setup()

        if self.twisted:
            self.run_with_twisted(**options)
        elif self.gunicorn:
            self.run_with_gunicorn(**options)
        else:
            self.run_with_werkzeug(**options)
1027177
def run(self):
        """"""
        kwargs = {'query': self.get_data()}
        if self.data_type == "ip":
            kwargs.update({'query_type': 'ip'})
        elif self.data_type == "network":
            kwargs.update({'query_type': 'network'})
        elif self.data_type == 'autonomous-system':
            kwargs.update({'query_type': 'asn'})
        elif self.data_type == 'port':
            kwargs.update({'query_type': 'port'})
        else:
            self.notSupported()
            return False

        if self.service == 'observations':
            response = self.bs.get_observations(**kwargs)
            self.report(response)
        elif self.service == 'enrichment':
            response = self.bs.enrich(**kwargs)
            self.report(response)
        else:
            self.report({'error': 'Invalid service defined.'})
610052
def run_configure(self, mandatory=True):
        
        if not has_file(self.working_dir, 'configure'):
            if mandatory:
                raise FileNotFoundError(
                    "Could not find a configure script for execution.")
            else:
                return
        try:
            prog = RunningProgram(self, 'configure')
            prog.expect_exit_status(0)
        except Exception:
            if mandatory:
                raise
1290510
def run(**kwargs):
    """"""
    paths = kwargs.pop('paths', ())
    action = kwargs.pop('action')
    plugin = kwargs.pop('plugin')
    junit_xml = kwargs.pop('junit_xml')
    use_tracked_files = kwargs.pop('use_tracked_files')
    quiet = kwargs.pop('quiet')

    colorama.init(strip=kwargs.pop('no_color'))

    git_dir = current_git_dir()

    if git_dir is None:
        output(NOT_GIT_REPO_MSG)
        exit(1)

    repo_root = os.path.dirname(git_dir)

    files = []
    if paths:
        # We want to look at files in their current state if paths are passed through
        kwargs['include_unstaged_changes'] = True

        # If paths were provided get all the files for each path
        for path in paths:
            for f in list_files(path):
                f = os.path.relpath(f, repo_root)
                if not f.startswith('..'):  # Don't include files outside the repo root.
                    files.append(f)
    elif use_tracked_files:
        # If the use tracked files flag was passed, get a list of all the tracked files
        out, err, code = git.ls_files()
        files = out.splitlines()

        if kwargs.get('include_untracked'):
            out, err, code = git.ls_files(o=True, exclude_standard=True)
            files += out.splitlines()

    if files or paths:
        kwargs['files'] = files

    config = get_config(repo_root)
    runner = Runner(config.cwd, **kwargs)
    results = ResultCollection()

    if runner.unstaged_changes and not quiet:
        output(UNSTAGED_CHANGES_MSG, end='\n\n')

    processes = list(config.actions) + list(config.plugins)
    processes.sort(key=lambda x: x.name)  # Sort the list of processes for consistent results

    if plugin:
        try:
            processes = [config.plugins.get(plugin)]
        except config.plugins.DoesNotExist as e:
            output('{}\nAvailable plugins:'.format(e.message))

            for p in config.plugins:
                output(p.name)
            exit(1)

    if action:
        try:
            processes = [config.actions.get(action)]
        except config.actions.DoesNotExist as e:
            output('{}\nAvailable actions:'.format(e.message))

            for a in config.actions:
                output(a.name)
            exit(1)

    for process in processes:
        result, message = runner.run_process(process)
        results.append(result)

        if not quiet:
            output(message)

    if junit_xml:
        with open(junit_xml, 'w+') as f:
            f.write('{}'.format(results.dump_junit()))

    if not quiet:
        output(results.dump())
        output('#{{bright}}{}\nCompleted in: {}s'.format(''.ljust(79, '-'), round(results.execution_time, 2)))

    if results.has_error:
        exit(1)
    elif results.has_failure:
        exit(2)
1170859
def run_configurations(callback, sections_reader):
    """"""
    base = dict(OPTIONS)
    sections = sections_reader()
    if sections is None:
        logger.info("Configuration not found in .ini files. "
                    "Running with default settings")
        recompile()
    elif sections == []:
        logger.info("Configuration does not match current runtime. "
                    "Exiting")
    results = []
    for section, options in sections:
        OPTIONS.clear()
        OPTIONS.update(base)
        OPTIONS.update(options)
        logger.debug("Running configuration from section \"%s\". OPTIONS: %r",
                     section, OPTIONS)
        results.append(callback())
    return results
57179
def run_suite(self, suite, **kwargs):
        """"""
        return self.test_runner(
            verbosity=self.verbosity,
            failfast=self.failfast,
            no_colour=self.no_colour,
        ).run(suite)
927501
def run():
    

    print('Python ' + sys.version.replace('\n', ''))

    try:
        oscrypto_tests_module_info = imp.find_module('tests', [os.path.join(build_root, 'oscrypto')])
        oscrypto_tests = imp.load_module('oscrypto.tests', *oscrypto_tests_module_info)
        oscrypto = oscrypto_tests.local_oscrypto()
        print('\noscrypto backend: %s' % oscrypto.backend())
    except (ImportError):
        pass

    if run_lint:
        print('')
        lint_result = run_lint()
    else:
        lint_result = True

    if run_coverage:
        print('\nRunning tests (via coverage.py)')
        sys.stdout.flush()
        tests_result = run_coverage(ci=True)
    else:
        print('\nRunning tests')
        sys.stdout.flush()
        tests_result = run_tests()
    sys.stdout.flush()

    return lint_result and tests_result
214891
def start
      suite = TestSuite.new
      testruns = @config.files.collect do |file|
        name = file.sub(Dir.pwd+'/','')
        suite.new_case(name, file)
      end
      test_loop_runner(suite)
    end