Module luatest.hooks | Tarantool
Reference Rocks reference Luatest Module luatest.hooks

Module luatest.hooks

Provide extra methods for hooks.

Preloaded hooks extend base hooks. They behave like the pytest fixture with the autouse parameter.

local hooks = require('luatest.hooks')

hooks.before_suite_preloaded(...)
hooks.after_suite_preloaded(...)

hooks.before_all_preloaded(...)
hooks.after_all_preloaded(...)

hooks.before_each_preloaded(...)
hooks.after_each_preloaded(...)

Register preloaded after hook in the all scope. It will be done after the classic after_all() hook in the tests.

Parameters:

  • fn: (func) The function where you will be cleaning up for the test.

Register preloaded after hook in the each scope. It will be done after the classic after_each() hook in the tests.

Parameters:

  • fn: (func) The function where you will be cleaning up for the test.

Register preloaded after hook in the suite scope. It will be done after the classic after_suite() hook in the tests.

Parameters:

  • fn: (func) The function where you will be cleaning up for the test.

Register preloaded before hook in the all scope. It will be done before the classic before_all() hook in the tests.

Parameters:

  • fn: (func) The function where you will be preparing for the test.

Register preloaded before hook in the each scope. It will be done before the classic before_each() hook in the tests.

Parameters:

  • fn: (func) The function where you will be preparing for the test.

Register preloaded before hook in the suite scope. It will be done before the classic before_suite() hook in the tests.

Parameters:

  • fn: (func) The function where you will be preparing for the test.
Found what you were looking for?
Feedback