Finish coverage reporting in kernel.

    The coverage should previously have been started with
    setup_coverage.
11310
def teardown_coverage(config, kernel, output_loc=None):
    
    language = kernel.language
    if language.startswith('python'):
        # Teardown code does not require any input, simply execute:
        msg_id = kernel.kc.execute(_python_teardown)
        kernel.await_idle(msg_id, 60)  # A minute should be plenty to write out coverage

        # Ensure we merge our data into parent data of pytest-cov, if possible
        cov = get_cov(config)
        _merge_nbval_coverage_data(cov)

    else:
        # Warnings should be given on setup, or there might be no teardown
        # for a specific language, so do nothing here
        pass
1142369
function suiteComplete(result) {
		if (result.coverage) {
			coverageCollector.addCoverage(result.coverage);
		}

		// Have all suites completed?
		let completedSuites = suitesWithState('complete');
		if(Object.keys(completedSuites).length < Object.keys(suites).length) {
			return;
		}
		// All suites have completed, send the “complete” message to karma
		if(isDebug) {
			let [total, finished] = countTests();
			console.debug(`All ${Object.keys(suites).length} suites have completed, ran ${finished} of ${total} tests`);
		}
		if (result.coverage) {
			result.coverage = coverageCollector.getFinalCoverage();
		}
		karma.complete(result);
	}
153090
def to_coverage(ctx):
    
    sm = Smother.load(ctx.obj['report'])
    sm.coverage = coverage.coverage()
    sm.write_coverage()
338039
def show_coverage
      unless @project.nil?
        line = "## Code coverage\n"
        line << total_coverage_markdown
        line << modified_files_coverage_table
        line << '> Powered by [Slather](https://github.com/SlatherOrg/slather)'
        markdown line
      end
    end
140692
def finish(self):
        """"""
        if self.anybar: self.anybar.change("purple")

        finish_blob = Blob()
        for module in self.modules:
            if hasattr(module, 'pre_finish'):
                log.info("Finishing {0}".format(module.name))
                start_time = timer()
                start_time_cpu = process_time()
                finish_blob[module.name] = module.pre_finish()
                self._timeit[module]['finish'] = timer() - start_time
                self._timeit[module]['finish_cpu'] = \
                    process_time() - start_time_cpu
            else:
                log.info("Skipping function module {0}".format(module.name))
        self._timeit['finish'] = timer()
        self._timeit['finish_cpu'] = process_time()
        self._print_timeit_statistics()
        self._finished = True

        if self.anybar: self.anybar.change("green")
        return finish_blob
1141092
def save_report(self, file_path):
        """"""
        try:
            report = self.create_report()
        except coverage.CoverageException as e:
            log.error('Failure to gather coverage:', exc_info=e)
        else:
            with open(file_path, 'w') as report_file:
                report_file.write(report)
674933
protected function logCoverage()
    {
        if (!$this->hasCoverage()) {
            return;
        }

        $filteredOptions = $this->options->filtered;

        $reporter = $this->getCoverage()->getReporter();

        if (isset($filteredOptions['coverage-clover'])) {
            $reporter->clover($filteredOptions['coverage-clover']);
        }

        if (isset($filteredOptions['coverage-html'])) {
            $reporter->html($filteredOptions['coverage-html']);
        }
        if (isset($filteredOptions['coverage-text'])) {
            $reporter->text();
        }

        if (isset($filteredOptions['coverage-xml'])) {
            $reporter->xml($filteredOptions['coverage-xml']);
        }

        $reporter->php($filteredOptions['coverage-php']);
    }
186507
private void finish() {
        try {
            GlobalEnablementBuilder globalEnablementBuilder = getBeanManager().getServices().get(GlobalEnablementBuilder.class);
            for (BeanRegistration registration : additionalBeans) {
                processBeanRegistration(registration, globalEnablementBuilder);
            }
            for (ObserverRegistration registration : additionalObservers) {
                processObserverRegistration(registration);
            }
        } catch (Exception e) {
            throw new DefinitionException(e);
        }
    }
1119941
def start_new_kernel(startup_timeout=60, kernel_name='python', **kwargs):
    """"""
    logger.debug('Starting new kernel: "%s"' % kernel_name)
    km = KernelManager(kernel_name=kernel_name,
                       kernel_spec_manager=NbvalKernelspecManager())
    km.start_kernel(**kwargs)
    kc = km.client()
    kc.start_channels()
    try:
        kc.wait_for_ready(timeout=startup_timeout)
    except RuntimeError:
        logger.exception('Failure starting kernel "%s"', kernel_name)
        kc.stop_channels()
        km.shutdown_kernel()
        raise

    return km, kc
1059408
def coverage_pileup(self, space, start, end):
        
        return ((col.pos, self._normalize(col.n, self._total))
                for col in self._bam.pileup(space, start, end))
259507
def coverage():
    """"""
    run("coverage run --source {PROJECT_NAME} -m py.test".format(PROJECT_NAME=PROJECT_NAME))
    run("coverage report -m")
    run("coverage html")

    webbrowser.open('file://' + os.path.realpath("htmlcov/index.html"), new=2)
340733
def report(coverage_path, sticky: true)
      if File.exist? coverage_path
        coverage_json = JSON.parse(File.read(coverage_path), symbolize_names: true)
        metrics = coverage_json[:metrics]
        percentage = metrics[:covered_percent]
        lines = metrics[:covered_lines]
        total_lines = metrics[:total_lines]

        formatted_percentage = format('%.02f', percentage)
        message("Code coverage is now at #{formatted_percentage}% (#{lines}/#{total_lines} lines)", sticky: sticky)
      else
        fail('Code coverage data not found')
      end
    end
641693
public function onInstallCommandCompletedOutputReport()
    {
        $report = new InstallReport($this->eventDataCollector, $this->dataCollectors);
        $report->generate($this->logger);
    }
244415
def compile_with_coverage_instrumentation(self, # type: ignore
                                              manager_container,
                                              container: 'Container', # type: ignore

                                              verbose: bool = False
                                              ) -> CompilationOutcome:
        
        if self.__command_with_instrumentation:
            cmd = self.__command_with_instrumentation
        else:
            cmd = self.__command

        return self.__compile(manager_container, container, cmd, verbose)
1184562
def _reset(self):
        """"""
        self.nr_of_executed_insns = 0
        self.begin = None
        self.end = None
        self.coverage = {}
959141
function runAfterSuccessScripts() {
  const autorelease =
    pkg.version === '0.0.0-semantically-released' &&
    parseEnv('TRAVIS', false) &&
    process.env.TRAVIS_BRANCH === 'master' &&
    !parseEnv('TRAVIS_PULL_REQUEST', false)

  const reportCoverage = hasFile('coverage') && !parseEnv('SKIP_CODECOV', false)

  if (!autorelease && !reportCoverage) {
    console.log(
      'No need to autorelease or report coverage. Skipping travis-after-success script...',
    )
  } else {
    const result = spawn.sync(
      resolveBin('concurrently'),
      getConcurrentlyArgs(
        {
          codecov: reportCoverage
            ? `echo installing codecov && npx -p codecov@3 -c 'echo running codecov && codecov'`
            : null,
          release: autorelease
            ? `echo installing semantic-release && npx -p semantic-release@15 -c 'echo running semantic-release && semantic-release'`
            : null,
        },
        {killOthers: false},
      ),
      {stdio: 'inherit'},
    )

    process.exit(result.status)
  }
}
1208430
def run(report)
      # The final lambda is the termination of the middleware stack. It calls deliver on the notification
      lambda_has_run = false
      notify_lambda = lambda do |notif|
        lambda_has_run = true
        yield if block_given?
      end

      begin
        # We reverse them, so we can call "call" on the first middleware
        middleware_procs.reverse.inject(notify_lambda) { |n,e| e.call(n) }.call(report)
      rescue StandardError => e
        # KLUDGE: Since we don't re-raise middleware exceptions, this breaks rspec
        raise if e.class.to_s == "RSpec::Expectations::ExpectationNotMetError"

        # We dont notify, as we dont want to loop forever in the case of really broken middleware, we will
        # still send this notify
        Bugsnag.configuration.warn "Bugsnag middleware error: #{e}"
        Bugsnag.configuration.warn "Middleware error stacktrace: #{e.backtrace.inspect}"
      end

      # Ensure that the deliver has been performed, and no middleware has botched it
      notify_lambda.call(report) unless lambda_has_run
    end