module Syskit::Test::Base

Base functionality for all testing cases

Public Instance Methods

assert_has_no_new_sample(reader, timeout = 0.2) click to toggle source

@deprecated use the expectations on {ExecutionExpectations} instead

# File lib/syskit/test/base.rb, line 64
def assert_has_no_new_sample(reader, timeout = 0.2)
    Roby.warn_deprecated "#{__method__} is deprecated, use the have_no_new_sample expectation on expect_execution instead"
    expect_execution.to do
        have_no_new_sample(reader, at_least_during: timeout)
    end
end
assert_has_one_new_sample(reader, timeout = 3) click to toggle source

@deprecated use the expectations on {ExecutionExpectations} instead

# File lib/syskit/test/base.rb, line 72
def assert_has_one_new_sample(reader, timeout = 3)
    Roby.warn_deprecated "#{__method__} is deprecated, use the have_one_new_sample expectation on expect_execution instead"
    expect_execution.to do
        have_one_new_sample(reader)
    end
end
plug_connection_management() click to toggle source
# File lib/syskit/test/base.rb, line 56
def plug_connection_management
    RobyApp::Plugin.plug_handler_in_roby(execution_engine, :connection_management)
end
plug_requirement_modifications() click to toggle source
# File lib/syskit/test/base.rb, line 49
def plug_requirement_modifications
    RobyApp::Plugin.plug_handler_in_roby(execution_engine, :apply_requirement_modifications)
end
setup() click to toggle source
Calls superclass method
# File lib/syskit/test/base.rb, line 14
def setup
    @task_stubs = Array.new
    @old_loglevel = Orocos.logger.level

    super
end
stub_type(name) click to toggle source

Creates a new null type and returns it

# File lib/syskit/test/base.rb, line 80
def stub_type(name)
    Roby.app.default_loader.
        resolve_type(name, define_dummy_type: true)
end
teardown() click to toggle source
Calls superclass method
# File lib/syskit/test/base.rb, line 21
def teardown
    # Disable log output to avoid spurious "stopped / interrupting"
    registered_plans.each do |p|
        if p.executable?
            p.find_tasks(Syskit::TaskContext).each do |t|
                flexmock(t).should_receive(:info)
            end
        end
    end

    plug_connection_management
    begin
        super
    rescue ::Exception => e
        teardown_failure = e
    end

    @task_stubs.each do |t|
        t.dispose
    end

ensure
    Orocos.logger.level = @old_loglevel if @old_loglevel
    if teardown_failure
        raise teardown_failure
    end
end
unplug_connection_management() click to toggle source
# File lib/syskit/test/base.rb, line 59
def unplug_connection_management
    RobyApp::Plugin.unplug_handler_from_roby(execution_engine, :connection_management)
end
unplug_requirement_modifications() click to toggle source
# File lib/syskit/test/base.rb, line 52
def unplug_requirement_modifications
    RobyApp::Plugin.unplug_handler_from_roby(execution_engine, :apply_requirement_modifications)
end