plainbox.abc – abstract base classes

Those classes are actually implemented in the plainbox.impl package. This module is here so that the essential API concepts are in a single spot and are easier to understand (by not being mixed with additional source code).

Note

This module has API stability guarantees. We are not going to break or introduce backwards incompatible interfaces here without following our API deprecation policy. All existing features will be retained for at least three releases. All deprecated symbols will warn when they will cease to be available.

class plainbox.abc.IExecutionController[source]

Interface for job execution controller clases.

Execution controllers encapsulate knowledge on how to run command associated with a particular job. Some executors might run the command directly, others might delegate the task to a helper program or perform some special-cased customization to the execution environment.

execute_job(job, config, extcmd_popen)[source]

Execute the specified job using the specified subprocess-like object

Parameters:
  • job – The JobDefinition to execute
  • config – A PlainBoxConfig instance which can be used to load missing environment definitions that apply to all jobs. It is used to provide values for missing environment variables that are required by the job (as expressed by the environ key in the job definition file).
  • extcmd_popen – A subprocess.Popen like object
Returns:

The return code of the command, as returned by subprocess.call()

get_score(job)[source]

Compute how applicable this controller is for the specified job.

Returns:A numeric score, or None if the controller cannot run this job. The higher the value, the more applicable this controller is.
class plainbox.abc.IJobDefinition[source]

Job definition that contains a mixture of meta-data and executable information that can be consumed by the job runner to produce results.

command[source]

The shell command to execute to perform the job.

The return code, standard output and standard error streams are automatically recorded and processed, depending on the plugin type.

This value can be None

depends[source]

Comma-delimited dependency expression

This field can be used to express job dependencies. If a job depends on another job it can only start if the other job had ran and succeeded.

This is the original data as provided when constructed. Use get_direct_dependencies() to obtain the parsed equivalent.

This value can be None

description[source]

Human-readable description of the job.

This field is typically used to include execution and verification steps for manual and human-assisted tests.

This value can be None

name[source]

Name of the job

plugin[source]

Name of the job interpreter.

Various interpreters are provided by the job runner.

requires[source]

List of expressions that need to be true for this job to be available

This value can be None

class plainbox.abc.IJobQualifier[source]

An opaque qualifier for a job definition.

This is an abstraction for matching jobs definitions to names, patterns and other means of selecting jobs.

designates(job)[source]

Check if this qualifier designates the specified plainbox.abc.IJobDefinition

Returns True:if the qualifier designates the specified job
Returns False:otherwise
class plainbox.abc.IJobResult[source]

Class for representing results from a single job

ALL_OUTCOME_LIST = [None, 'pass', 'fail', 'skip', 'not-supported', 'not-implemented', 'undecided']
OUTCOME_FAIL = 'fail'
OUTCOME_NONE = None
OUTCOME_NOT_IMPLEMENTED = 'not-implemented'
OUTCOME_NOT_SUPPORTED = 'not-supported'
OUTCOME_PASS = 'pass'
OUTCOME_SKIP = 'skip'
OUTCOME_UNDECIDED = 'undecided'
comments[source]

The comment that was added by the user, if any

get_io_log()[source]

Compute and return the sequence of IOLogRecord objects.

Returns:A sequence of tuples (delay, stream-name, data) where delay is the delay since the previous message seconds (typically a fractional number), stream name is either ‘stdout’ or ‘stderr’ and data is the bytes object that was obtained from that stream.
io_log[source]

A sequence of tuples (delay, stream-name, data) where delay is the delay since the previous message seconds (typically a fractional number), stream name is either ‘stdout’ or ‘stderr’ and data is the bytes object that was obtained from that stream.

outcome[source]

Outcome of the test.

The result of either automatic or manual verification. Depending on the plugin (test type). Available values are defined as class properties above.

return_code[source]

Command return code.

This is the return code of the process started to execute the command from the job definition. It can also encode the signal that the process was killed with, if any.

class plainbox.abc.IJobRunner[source]

Something that can run a job definition and produce results.

You can run many jobs with one runner, each time you’ll get additional result object. Typically you will need to connect the runner to a user interface but headless mode is also possible.

run_job(job)[source]

Run the specified job.

Calling this method may block for arbitrary amount of time. User interfaces should ensure that it runs in a separate thread.

The return value is a JobResult object that contains all the data that was captured during the execution of the job. Some jobs may not return a JobResult value.

class plainbox.abc.IProvider1[source]

Provider for the current type of tests

Also known as the ‘checkbox-like’ provider.

description[source]

description of this providr

This name should be dbus-friendly. It should not be localizable.

get_builtin_jobs()[source]

Load all the built-in jobs and return them

get_builtin_whitelists()[source]

Load all the built-in whitelists and return them

name[source]

name of this provider

This name should be dbus-friendly. It should not be localizable.

version[source]

version of this provider

class plainbox.abc.IProviderBackend1[source]

Provider for the current type of tests.

This class provides the APIs required by the internal implementation that are not considered normal public APIs. The only consumer of the those methods and properties are internal to plainbox.

CHECKBOX_SHARE[source]

Return the required value of CHECKBOX_SHARE environment variable.

Note

This variable is only required by one script. It would be nice to remove this later on.

bin_dir[source]

directory where all the executables needed by this provider reside

extra_PYTHONPATH[source]

Return additional entry for PYTHONPATH, if needed.

This entry is required for CheckBox scripts to import the correct CheckBox python libraries.

Note

The result may be None

secure[source]

flag indicating that this provider was loaded from the secure portion of PROVIDERPATH and thus can be used with the plainbox-trusted-launcher-1.

class plainbox.abc.ISessionStateController[source]

Interface for session state controller classes.

Session state controller classes cooperate with SessionState and DependencySolver classes and implement knowledge unique to particular job semantics. Before execution the controller can influence job runnability (by setting inhibitors). After execution the controller can observe the result and influence session state

get_dependency_set(job)[source]

Get the set of direct dependencies of a particular job.

Parameters:job – A IJobDefinition instance that is to be visited
Returns:set of pairs (dep_type, job_name)

Returns a set of pairs (dep_type, job_name) that describe all dependencies of the specified job. The first element in the pair, dep_type, is either DEP_TYPE_DIRECT or DEP_TYPE_RESOURCE. The second element is the name of the job.

get_inhibitor_list(session_state, job)[source]

Get a list of readiness inhibitors that inhibit a particular job.

Parameters:
  • session_state – A SessionState instance that is used to interrogate the state of the session where it matters for a particular job. Currently this is used to access resources and job results.
  • job – A JobDefinition instance
Returns:

List of JobReadinessInhibitor

observe_result(session_state, job, result)[source]

Notice the specified test result and update readiness state.

Parameters:
  • session_state – A SessionState object
  • job – A JobDefinition object
  • result – A IJobResult object

This function updates the internal result collection with the data from the specified test result. Results can safely override older results. Results also change the ready map (jobs that can run) because of dependency relations.

class plainbox.abc.ITextSource[source]

An abstract source of text.

Concrete instances of this class are used by plainbox.impl.rfc822.Origin to keep track of where each entry of a RFC822-like document came from.

class plainbox.abc.IUserInterfaceIO[source]

Base class that allows job runner to interact with the user interface.

get_manual_verification_outcome()[source]

Get the outcome of the manual verification, as according to the user May raise NotImplementedError if the user interface cannot provide this answer.

Previous topic

plainbox – main package

Next topic

plainbox.impl – implementation package

This Page