Sha256: 2cfec74d2f06ef1fc90a1b2e1f487d2e703af0ca3d3a9212deaba8aec848d802

Contents?: true

Size: 1.11 KB

Versions: 9

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

require 'bundler/setup'

require_relative './coverage' if ENV['COVERAGE']

require 'polyphony'

require 'fileutils'
require_relative './eg'

require 'minitest/autorun'
require 'minitest/reporters'

::Exception.__disable_sanitized_backtrace__ = true

Minitest::Reporters.use! [
  Minitest::Reporters::SpecReporter.new
]

class ::Fiber
  attr_writer :auto_watcher
end

class MiniTest::Test
  def setup
    # puts "* setup #{self.name}"
    if Fiber.current.children.size > 0
      puts "Children left: #{Fiber.current.children.inspect}"
      exit!
    end
    Fiber.current.setup_main_fiber
    Fiber.current.instance_variable_set(:@auto_watcher, nil)
    Thread.current.agent = Polyphony::LibevAgent.new
    sleep 0
  end

  def teardown
    # puts "* teardown #{self.name.inspect} Fiber.current: #{Fiber.current.inspect}"
    Fiber.current.terminate_all_children
    Fiber.current.await_all_children
    Fiber.current.auto_watcher = nil
  rescue => e
    puts e
    puts e.backtrace.join("\n")
    exit!
  end
end

module Kernel
  def capture_exception
    yield
  rescue Exception => e
    e
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
polyphony-0.43.6 test/helper.rb
polyphony-0.43.5 test/helper.rb
polyphony-0.43.4 test/helper.rb
polyphony-0.43.3 test/helper.rb
polyphony-0.43.2 test/helper.rb
polyphony-0.43.1 test/helper.rb
polyphony-0.43 test/helper.rb
polyphony-0.42 test/helper.rb
polyphony-0.41 test/helper.rb