<commit_before># simplecov must be loaded FIRST. Only the files required after it gets loaded
# will be profiled !!!
if ENV['TEST_ENABLE_COVERAGE'] == '1'
    begin
        require 'simplecov'
        SimpleCov.start
    rescue LoadError
        require 'utilrb'
        Utilrb.warn "coverage is disabled because the 'simplecov' gem cannot be loaded"
    rescue Exception => e
        require 'utilrb'
        Utilrb.warn "coverage is disabled: #{e.message}"
    end
end

require 'utilrb'
require 'minitest/autorun'
require 'minitest/spec'
require 'flexmock/test_unit'

if ENV['TEST_ENABLE_PRY'] != '0'
    begin
        require 'pry'
    rescue Exception
        Utilrb.warn "debugging is disabled because the 'pry' gem cannot be loaded"
    end
end

BASE_TEST_DIR=File.expand_path('../../test', File.dirname(__FILE__))

module Utilrb
    # This module is the common setup for all tests
    #
    # It should be included in the toplevel describe blocks
    #
    # @example
    #   require 'dummyproject/test'
    #   describe Utilrb do
    #     include Utilrb::SelfTest
    #   end
    #
    module SelfTest
        if defined? FlexMock
            include FlexMock::ArgumentTypes
            include FlexMock::MockContainer
        end

        def setup
            # Setup code for all the tests
        end

        def teardown
            if defined? FlexMock
                flexmock_teardown
            end
            super
            # Teardown code for all the tests
        end
    end
end

module Minitest
    class Spec
        include Utilrb::SelfTest
    end
    class Test
        include Utilrb::SelfTest
    end<commit_msg>test: add interaction fix between flexmock and minitest<commit_after># simplecov must be loaded FIRST. Only the files required after it gets loaded
# will be profiled !!!
if ENV['TEST_ENABLE_COVERAGE'] == '1'
    begin
        require 'simplecov'
        SimpleCov.start
    rescue LoadError
        require 'utilrb'
        Utilrb.warn "coverage is disabled because the 'simplecov' gem cannot be loaded"
    rescue Exception => e
        require 'utilrb'
        Utilrb.warn "coverage is disabled: #{e.message}"
    end
end

require 'utilrb'
require 'minitest/autorun'
require 'minitest/spec'
require 'flexmock/test_unit'

if ENV['TEST_ENABLE_PRY'] != '0'
    begin
        require 'pry'
    rescue Exception
        Utilrb.warn "debugging is disabled because the 'pry' gem cannot be loaded"
    end
end

BASE_TEST_DIR=File.expand_path('../../test', File.dirname(__FILE__))

module Utilrb
    # This module is the common setup for all tests
    #
    # It should be included in the toplevel describe blocks
    #
    # @example
    #   require 'dummyproject/test'
    #   describe Utilrb do
    #     include Utilrb::SelfTest
    #   end
    #
    module SelfTest
        if defined? FlexMock
            include FlexMock::ArgumentTypes
            include FlexMock::MockContainer
        end

        def setup
            # Setup code for all the tests
        end

        def teardown
            if defined? FlexMock
                flexmock_teardown
            end
            super
            # Teardown code for all the tests
        end
    end
end

# Workaround a problem with flexmock and minitest not being compatible with each
# other (currently). See github.com/jimweirich/flexmock/issues/15.
if defined?(FlexMock) && !FlexMock::TestUnitFrameworkAdapter.method_defined?(:assertions)
    class FlexMock::TestUnitFrameworkAdapter
        attr_accessor :assertions
    end
    FlexMock.framework_adapter.assertions = 0
end

module Minitest
    class Spec
        include Utilrb::SelfTest
    end
    class Test
        include Utilrb::SelfTest
    end
{'fraction_non_alphanumeric': 0.06707974137931035, 'fraction_numerical': 0.0018857758620689656, 'mean_word_length': 2.285840707964602, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '464927', 'n_tokens_mistral': 1065, 'n_tokens_neox': 1047, 'n_words': 355}