<commit_before>
#
# testing ruote
#
# Sat Sep 20 23:40:10 JST 2008
#

require 'fileutils'

require File.expand_path('../../test_helper', __FILE__)
require File.expand_path('../storage_helper', __FILE__)
require File.expand_path('../signals', __FILE__)

require 'ruote'


#
# Most of the functional tests extend this class.
#
module FunctionalBase

  def setup

    p self.class if ARGV.include?('-T') or ARGV.include?('-N')

    #require 'ruote/util/look'
    #Ruote::Look.dump_lsof
    #Ruote::Look.dump_lsof_count
      #
      # uncomment this when "too many open files"

    sto = determine_storage({})

    @dashboard = Ruote::Dashboard.new(
      sto.class.name.match(/Worker$/) ? sto : Ruote::Worker.new(sto))

    @engine = @dashboard
      # for 'backward compatibility'

    $_test = self
    $_dashboard = @dashboard
      #
      # handy when hijacking (https://github.com/ileitch/hijack)
      # or flinging USR2 at the test process

    @tracer = Tracer.new

    tracer = @tracer
    @dashboard.context.instance_eval { @tracer = tracer }

    @dashboard.add_service('tracer', @tracer)
    @dashboard.add_service('stash', {})

    noisy if ARGV.include?('-N')

    #noisy # uncommented, it makes all the tests noisy
  end

  def teardown

    @dashboard.shutdown
    @dashboard.context.storage.purge!
    @dashboard.context.storage.close if @dashboard.context.storage.respond_to?(:close)
  end

  def stash

    @dashboard.context.stash
  end

  def assert_log_count(count, &block)

    c = @dashboard.context.logger.log.select(&block).size

    #logger.to_stdout if ( ! @dashboard.context[:noisy]) && c != count<commit_msg>no more "undefined method 'shutdown'"<commit_after>
#
# testing ruote
#
# Sat Sep 20 23:40:10 JST 2008
#

require 'fileutils'

require File.expand_path('../../test_helper', __FILE__)
require File.expand_path('../storage_helper', __FILE__)
require File.expand_path('../signals', __FILE__)

require 'ruote'


#
# Most of the functional tests extend this class.
#
module FunctionalBase

  def setup

    p self.class if ARGV.include?('-T') or ARGV.include?('-N')

    #require 'ruote/util/look'
    #Ruote::Look.dump_lsof
    #Ruote::Look.dump_lsof_count
      #
      # uncomment this when "too many open files"

    sto = determine_storage({})

    @dashboard = Ruote::Dashboard.new(
      sto.class.name.match(/Worker$/) ? sto : Ruote::Worker.new(sto))

    @engine = @dashboard
      # for 'backward compatibility'

    $_test = self
    $_dashboard = @dashboard
      #
      # handy when hijacking (https://github.com/ileitch/hijack)
      # or flinging USR2 at the test process

    @tracer = Tracer.new

    tracer = @tracer
    @dashboard.context.instance_eval { @tracer = tracer }

    @dashboard.add_service('tracer', @tracer)
    @dashboard.add_service('stash', {})

    noisy if ARGV.include?('-N')

    #noisy # uncommented, it makes all the tests noisy
  end

  def teardown

    return if @dashboard.nil?

    @dashboard.shutdown
    @dashboard.context.storage.purge!
    @dashboard.context.storage.close if @dashboard.context.storage.respond_to?(:close)
  end

  def stash

    @dashboard.context.stash
  end

  def assert_log_count(count, &block)

    c = @dashboard.context.logger.log.select(&block).size

    #logger.to_stdout if ( ! @dashboard.context[:noisy]) && c != count
{'fraction_non_alphanumeric': 0.13307299489336136, 'fraction_numerical': 0.007810153199158907, 'mean_word_length': 3.247448979591837, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2064513', 'n_tokens_mistral': 1165, 'n_tokens_neox': 1120, 'n_words': 250}