Module: Syskit::Test::Base
Overview
Base functionality for all testing cases
Instance Method Summary collapse
-
#assert_has_no_new_sample(reader, timeout = 0.2) ⇒ Object
deprecated
Deprecated.
use the expectations on ExecutionExpectations instead
-
#assert_has_one_new_sample(reader, timeout = 3) ⇒ Object
deprecated
Deprecated.
use the expectations on ExecutionExpectations instead
- #plug_connection_management ⇒ Object
- #plug_requirement_modifications ⇒ Object
- #setup ⇒ Object
-
#stub_type(name) ⇒ Object
Creates a new null type and returns it.
- #teardown ⇒ Object
- #unplug_connection_management ⇒ Object
- #unplug_requirement_modifications ⇒ Object
Instance Method Details
#assert_has_no_new_sample(reader, timeout = 0.2) ⇒ Object
Deprecated.
use the expectations on ExecutionExpectations instead
64 65 66 67 68 69 |
# 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) ⇒ Object
Deprecated.
use the expectations on ExecutionExpectations instead
72 73 74 75 76 77 |
# 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 ⇒ Object
56 57 58 |
# 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 ⇒ Object
49 50 51 |
# 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 ⇒ Object
14 15 16 17 18 19 |
# File 'lib/syskit/test/base.rb', line 14 def setup @task_stubs = Array.new @old_loglevel = Orocos.logger.level super end |
#stub_type(name) ⇒ Object
Creates a new null type and returns it
80 81 82 83 |
# 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 ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# 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 ⇒ Object
59 60 61 |
# 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 ⇒ Object
52 53 54 |
# File 'lib/syskit/test/base.rb', line 52 def unplug_requirement_modifications RobyApp::Plugin.unplug_handler_from_roby(execution_engine, :apply_requirement_modifications) end |