topology.pytest.plugin

topology pytest plugin module entry point.

This plugin provides a fixture topology that will load and build a topology description from the module. This topology must be present in the module as a constant variable TOPOLOGY. It can be either a string and thus the method topology.manager.TopologyManager.parse() will be used, or a dictionary in which case the method topology.manager.TopologyManager.load() will be used. Once built, the plugin registers the unbuild for when the module has ended all the tests.

If the TOPOLOGY variable isn’t present the fixture assumes the user will prefer to build the topology using the standard NML objects with the pynml.manager.NMLManager instance enbeed into the topology.manager.TopologyManager.

To be able to select the platform engine this plugins registers the --topology-platform option that can be set in pytest command line.

For reference see:

Functions

topology.pytest.plugin.topology(request)

Fixture that injects a TopologyManager into as a test fixture.

See:

topology.pytest.plugin.pytest_addoption(parser)

pytest hook to add CLI arguments.

topology.pytest.plugin.pytest_configure(config)

pytest hook to configure plugin.

Classes

class topology.pytest.plugin.TopologyPlugin(platform, plot_dir, plot_format, nml_dir, injected_attr, log_dir)

pytest plugin for Topology.

Parameters:
  • platform (str) – Platform engine name to run the tests with.
  • plot_dir (str) – Directory to auto-plot topologies. None if feature is disabled.
  • plot_format (str) – Format to plot the topologies.
  • nml_dir (str) – Directory to auto-export topologies. None if feature is disabled.

Inheritance

Inheritance diagram of TopologyPlugin

pytest_report_header(config)

pytest hook to print information of the report header.

class topology.pytest.plugin.StepLogger(nameparts={'test_case': '', 'test_suite': ''}, *args, **kwargs)

Stepper logging class.

This class will log a message and will show the step number and the caller name and line number.

Inheritance

Inheritance diagram of StepLogger