Sha256: 4b26730845d488656df4ae7e8b3bedff5257b3d6b7a35aceecb599168715a467

Contents?: true

Size: 1.95 KB

Versions: 20

Compression:

Stored size: 1.95 KB

Contents

# 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 'dummy_project'
        Autoproj.warn "coverage is disabled because the 'simplecov' gem cannot be loaded"
    rescue Exception => e
        require 'dummy_project'
        Autoproj.warn "coverage is disabled: #{e.message}"
    end
end

require 'autoproj'
## Uncomment this to enable flexmock
require 'flexmock/test_unit'
require 'minitest/spec'

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

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

        def setup
            @tmpdir = Array.new
            super
        end

        def create_bootstrap
            dir = Dir.mktmpdir
            @tmpdir << dir
            require 'autoproj/ops/main_config_switcher'
            FileUtils.cp_r Ops::MainConfigSwitcher::MAIN_CONFIGURATION_TEMPLATE, File.join(dir, 'autoproj')
            Autoproj.root_dir = dir
            Autoproj.manifest = Manifest.load(File.join(dir, 'autoproj', 'manifest'))
        end

        def teardown
            if defined? FlexMock
                flexmock_teardown
            end
            super
            @tmpdir.each do |dir|
                FileUtils.remove_entry_secure dir
            end
            Autobuild::Package.clear
        end
    end
end

class Minitest::Test
    include Autoproj::SelfTest
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
autoproj-1.13.7 lib/autoproj/test.rb
autoproj-1.13.6 lib/autoproj/test.rb
autoproj-1.13.5 lib/autoproj/test.rb
autoproj-1.13.5.rc1 lib/autoproj/test.rb
autoproj-1.13.4 lib/autoproj/test.rb
autoproj-1.13.3 lib/autoproj/test.rb
autoproj-1.13.3.b2 lib/autoproj/test.rb
autoproj-1.13.3.b1 lib/autoproj/test.rb
autoproj-1.13.2.b4 lib/autoproj/test.rb
autoproj-1.13.2.b3 lib/autoproj/test.rb
autoproj-1.13.2.b2 lib/autoproj/test.rb
autoproj-1.13.2.b1 lib/autoproj/test.rb
autoproj-2.0.0.b7 lib/autoproj/test.rb
autoproj-2.0.0.b6 lib/autoproj/test.rb
autoproj-2.0.0.b5 lib/autoproj/test.rb
autoproj-2.0.0.b4 lib/autoproj/test.rb
autoproj-2.0.0.b3 lib/autoproj/test.rb
autoproj-2.0.0.b2 lib/autoproj/test.rb
autoproj-2.0.0.b1 lib/autoproj/test.rb
autoproj-1.13.2 lib/autoproj/test.rb