pcvs.backend.config module

class pcvs.backend.config.ConfigurationBlock(kind, name, scope=None)[source]

Bases: object

Handle the basic configuration block, smallest part of a profile.

From a user persperctive, a basic block is a dict, gathering in a Python object informations relative to the configuration of a single component. In PCVS, there is 5 types of components:

  • Compiler-oriented (defining compiler commands)

  • Runtime-oriented (setting runtime & parametrization)

  • Machine-oriented (Defining resources used for execution)

  • Group-oriented (used a templates to globally describe tests)

  • Criterion-oriented (range of parameters used to run a test-suite)

This class helps to manage any of these config blocks above. The distinction between them is carried over by an instance attribute _kind.


This object can easily be confused with system.Config. While ConfigurationBlocks are from a user perspective, system.Config handles the internal configuration tree, on which runs rely. Nonetheless, both could be merged into a single representation in later versions.

  • _kind (str) – which component this object describes

  • _name (str) – block name

  • details (dict) – block content

  • _scope (str) – block scope, may be None

  • _file (str) – absolute path for the block on disk

  • _exists (bool) – True if the block exist on disk

check() None[source]

Validate a single configuration block according to its scheme.

clone(clone: ConfigurationBlock) None[source]

Copy the current object to create an identical one.

Mainly used to mirror two objects from different scopes.


clone (ConfigurationBlock) – the object to mirror

delete() None[source]

Delete a configuration block from disk

display() None[source]

Configuration block pretty printer

dump() dict[source]

Convert the configuration Block to a regular dict.

This function first load the last version, to ensure being in sync.


a regular dict() representing the config blocK

Return type


edit(e=None) None[source]

Open the current block for edition.


Exception – Something occured on the edited version.


e (str) – the EDITOR to use instead of default.

edit_plugin(e=None) None[source]

Special case to handle ‘plugin’ key for ‘runtime’ blocks.

This allows to edit a de-serialized version of the ‘plugin’ field. By default, data are stored as a base64 string. In order to let user edit the code, the string need to be decoded first.


e (str) – the editor to use instead of defaults

fill(raw) None[source]

Populate the block content with parameters.


raw (dict) – the data to fill.

flush_to_disk() None[source]

write the configuration block to disk

property full_name: str

Return complete block label (scope + kind + name)


the fully-qualified name.

Return type


is_found() bool[source]

Check if the current config block is present on fs.


True if it exists

Return type


load_from_disk() None[source]

load the configuration file to populate the current object.

load_template(name=None) None[source]

load from the specific template, to create a new config block

property ref_file: str

Return filepath associated with current config block.


the filepath, may be None

Return type


retrieve_file() None[source]

Associate the actual filepath to the config block.

From the stored kind, scope, name, attempt to detect configuration block on the file system (i.e. detected during module init())

property scope: str

Return block scope.


the scope, resolved if needed.

Return type


property short_name: str

Return the block label only.


the short name (may conflict with other config block)

Return type



Assert the parameter is a valid kind.

Kind are defined by CONFIG_BLOCKS module attribute.


s (str) – the kind to validate

pcvs.backend.config.init() None[source]

Load configuration tree available on disk.

This function is called when PCVS starts to load 3-scope configuration trees.

pcvs.backend.config.list_blocks(kind, scope=None)[source]

Get available configuration blocks, as present on disk.

  • kind (str, one of CONFIG_BLOCKS values) – configBlock kind (see CONFIG_BLOCKS for possible values)

  • scope ('user', 'global' or 'local', optional) – where the configblocks is located, defaults to None


list blocks with specified kind, restricted by scope (if any)

Return type

dict of config blocks


List available templates to be used for boostraping config. blocks.


a list of valid templates.

Return type