<commit_before>require "minitest"
require "minitest/autorun"
require_relative "../../lib/celluloid_benchmark/runner"
require "fakeweb"

FakeWeb.allow_net_connect = false

module CelluloidBenchmark
  class BenchmarkRunnerTest < Minitest::Test
    def setup
      # minitest and Celluloid both use at_exit
      Celluloid.boot
    end

    def test_run
      FakeWeb.register_uri(:get, "https://github.com/scottwillson/celluloid-benchmark", :body => "<html>OK</html>")
      benchmark_run = Runner.run(session: File.dirname(__FILE__) + "/../files/runner_test_session.rb", duration: 0.1)

      benchmarks = benchmark_run.benchmarks
      assert_equal 1, benchmarks.size
      benchmark = benchmarks.first
      assert benchmark.ok?, "benchmark.ok?"
    end

    def test_run_with_visitors_arg
      FakeWeb.register_uri(:get, "https://github.com/scottwillson/celluloid-benchmark", :body => "<html>OK</html>")
      benchmark_run = Runner.run(session: File.dirname(__FILE__) + "/../files/runner_test_session.rb", duration: 0.1, visitors: "12")

      benchmarks = benchmark_run.benchmarks
      assert_equal 1, benchmarks.size
      benchmark = benchmarks.first
      assert benchmark.ok?, "benchmark.ok?"
    end
  end
end
<commit_msg>Fix timing failure in test<commit_after>require "minitest"
require "minitest/autorun"
require_relative "../../lib/celluloid_benchmark/runner"
require "fakeweb"

FakeWeb.allow_net_connect = false

module CelluloidBenchmark
  class BenchmarkRunnerTest < Minitest::Test
    def setup
      # minitest and Celluloid both use at_exit
      Celluloid.boot
    end

    def test_run
      FakeWeb.register_uri(:get, "https://github.com/scottwillson/celluloid-benchmark", :body => "<html>OK</html>")
      benchmark_run = Runner.run(session: File.dirname(__FILE__) + "/../files/runner_test_session.rb", duration: 0.2)

      benchmarks = benchmark_run.benchmarks
      assert_equal 1, benchmarks.size
      benchmark = benchmarks.first
      assert benchmark.ok?, "benchmark.ok?"
    end

    def test_run_with_visitors_arg
      FakeWeb.register_uri(:get, "https://github.com/scottwillson/celluloid-benchmark", :body => "<html>OK</html>")
      benchmark_run = Runner.run(session: File.dirname(__FILE__) + "/../files/runner_test_session.rb", duration: 0.2, visitors: "12")

      benchmarks = benchmark_run.benchmarks
      assert_equal 1, benchmarks.size
      benchmark = benchmarks.first
      assert benchmark.ok?, "benchmark.ok?"
    end
  end
end

{'fraction_non_alphanumeric': 0.11859620814844696, 'fraction_numerical': 0.00645421540943929, 'mean_word_length': 3.7058823529411766, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 4, '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': '1747223', 'n_tokens_mistral': 819, 'n_tokens_neox': 786, 'n_words': 154}