Plugins/Hooks

Much like pytest, itself, pytest-localstack uses pluggy to implement a plugin system. These plugins can be used to add additional functionality to pytest-localstack and to trigger callbacks when the Localstack container is started and stopped.

pytest_localstack.hookspecs.contribute_to_module(pytest_localstack)[source]

Hook to add additional functionality to the pytest_localstack module.

Primarially used to add importable fixture factories at a top level.

pytest_localstack.hookspecs.contribute_to_session(session)[source]

Hook to add additional functionality to LocalstackSession.

Primarially used to add test resource factories to sessions. See pytest_localstack.contrib.botocore for an example of that.

pytest_localstack.hookspecs.session_started(session)[source]

Hook fired when LocalstackSession has started.

pytest_localstack.hookspecs.session_starting(session)[source]

Hook fired when LocalstackSession is starting.

pytest_localstack.hookspecs.session_stopped(session)[source]

Hook fired when LocalstackSession has stopped.

pytest_localstack.hookspecs.session_stopping(session)[source]

Hook fired when LocalstackSession is stopping.

Plugins manager.

See also

hookspecs

pytest_localstack.plugin.register_plugin_module(module_path, required=True)[source]

Register hooks in a module with the PluginManager by Python path.

Parameters:
  • module_path (str) – A Python dotted import path.
  • required (bool, optional) – If False, ignore ImportError. Default: True.
Returns:

The imported module.

Raises:

ImportError – If required is True and the module cannot be imported.