xtesting.energy.energy module

This module manages calls to Energy recording API.

class xtesting.energy.energy.EnergyRecorder

Bases: object

Manage Energy recording session.

CONNECTION_TIMEOUT = 4
INITIAL_STEP = 'running'
energy_recorder_api = None
static get_current_scenario()

Get current running scenario (if any, None else).

static load_config()

Load connectivity settings from yaml.

Load connectivity settings to Energy recording API

logger = <logging.Logger object>
static set_step(step)

Notify energy recording service of current step of the testcase.

static start(scenario)

Start a recording session for scenario.

param scenario: Starting scenario :type scenario: string
static stop()

Stop current recording session.

static submit_scenario(scenario, step)

Submit a complet scenario definition to Energy recorder API.

param scenario: Scenario name :type scenario: string param step: Step name :type step: string
xtesting.energy.energy.enable_recording(method)

Record energy during method execution.

Decorator to record energy during “method” exection.

param method: Method to suround with start and stop :type method: function

Note

“method” should belong to a class having a “case_name” attribute

xtesting.energy.energy.finish_session(current_scenario)

Finish a recording session.