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.
A pluggable build system definition
PlainBox uses build systems to assist provider authors in building additional executables from source code. To facilitate support for a specific language or toolkit a build system may detect it and offer proper commands without the test developer having to copy/paste those commands from provider to provider.
PlainBox discovers providers from the plainbox.buildsystem entry point. Each entry point there must be a class implementing this interface.
Get shell command to build the sources.
Parameters: |
|
---|---|
Returns: | shell command to execute |
With the given source and build directory, come up with a piece of shell that knows how to build stuff so that it ends up in the build directory.
Note
The command will be executed in build_dir.
Look at the source directory and determine how applicable this build system is.
Parameters: | src_dir – absolute path of the directory with source code |
---|---|
Returns: | the suitability value, 0 if the build system doesn’t support sources of the particular kind, all values greater than zero indicate some level of suitability. The largest return value wins. |
The return value is a number. Values closer to zero mean that the build system is not suitable, values closer to one mean the build system is more suitable. Value of 0 mean that the build system is totally unsuitable and will not be applied, even if no other choices are available.
The idea is that multiple build systems may recognize a source directory but since the system is extensible, other people may come up with more suitable build system that spots additional files and returns a score better than the average.
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 the specified job using the specified subprocess-like object
Parameters: |
|
---|---|
Returns: | The return code of the command, as returned by subprocess.call() |
Job definition that contains a mixture of meta-data and executable information that can be consumed by the job runner to produce results.
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
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
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
An opaque qualifier for a job definition.
This is an abstraction for matching jobs definitions to names, patterns and other means of selecting jobs.
There are two ways to use a qualifier object. The naive, direct, old API can simply check if a qualifier designates a particular job (if it selects it and marks for subsequent execution). This API works fine for certain tasks but it was found that it is insufficient to implement so-called whitelist ordering, where the order of jobs in a whitelist is preserved when selecting that whitelist for execution. This spawned the second, lower-level API, that gives portable visibility into composite qualifiers (such as a whitelist) and distinct select, deselect vote so that full range of current expressiveness can be preserved.
Attr VOTE_EXCLUDE: | |
---|---|
(0) vote indicating that a job should not be included for selection. It overwrites any other votes. | |
Attr VOTE_INCLUDE: | |
(1) vote indicating that a job should be included for selection. It is overridden by VOTE_EXCLUDE. | |
Attr VOTE_IGNORE: | |
(2) vote indicating that a job should neither be included nor excluded for selection. This is a neutral value overridden by all other votes. |
Check if this qualifier designates the specified plainbox.abc.IJobDefinition
Returns True: | if the qualifier designates the specified job |
---|---|
Returns False: | otherwise |
Return a list of primitives that constitute this qualifier.
Returns: | A list of IJobQualifier objects that each is the smallest, indivisible entity. |
---|
When each vote cast by those qualifiers is applied sequentially to a given job then the result is the same as the return value of the designates() method. The resulting list has more structure and this structure may matter to job ordering when a list of jobs is matched against a list of qualifiers. The resulting sets are identical but ordering of results is more accurately reflected by iterating over the fine structure of each qualifier.
Get one of the VOTE_IGNORE, VOTE_INCLUDE, VOTE_EXCLUDE votes that this qualifier associated with the specified job.
Parameters: | job – A IJobDefinition instance that is to be visited |
---|---|
Returns: | one of the VOTE_xxx constants |
property indicating that a qualifier is not divisible by calling get_primitive_qualifiers().
If a qualifier is not primitive it can be replaced with a list of qualifiers it produces by the call to the aforementioned method.
Class for representing results from a single job
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. |
---|
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.
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 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.
Provider for the current type of tests
Also known as the ‘checkbox-like’ provider.
Load and parse all of the job definitions of this provider.
Returns: | A sorted list of JobDefinition objects |
---|---|
Raises: |
|
the name of the gettext domain associated with this provider
This value may be empty, in such case provider data cannot be localized for the user environment.
Load and parse all of the job definitions of this provider.
Unlike get_builtin_jobs() this method does not stop after the first problem encountered and instead collects all of the problems into a list which is returned alongside the job list.
Returns: | Pair (job_list, problem_list) where each job_list is a sorted list of JobDefinition objects and each item from problem_list is an exception. |
---|
absolute path of the directory with locale data
The value is applicable as argument bindtextdomain()
name of this provider
This name should be dbus-friendly. It should not be localizable.
namespace component of the provider name
This property defines the namespace in which all provider jobs are defined in. Jobs within one namespace do not need to be fully qualified by prefixing their partial identifier with provider namespace (so all stays ‘as-is’). Jobs that need to interact with other provider namespaces need to use the fully qualified job identifier instead.
The identifier is defined as the part of the provider name, up to the colon. This effectively gives organizations flat namespace within one year-domain pair and allows to create private namespaces by using sub-domains.
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.
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.
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
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 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 a list of readiness inhibitors that inhibit a particular job.
Parameters: |
|
---|---|
Returns: | List of JobReadinessInhibitor |
Notice the specified test result and update readiness state.
Parameters: |
|
---|
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.
Interface for transports that send test data somewhere.
They handle just the transmission portion of data sending; exporters are expected to produce data in the proper format (e.g. json, xml).
Each transport can have specific parameters that are required for the other end to properly process received information (like system identification, authorization data and so on), and that don’t semantically belong in the test data as produced by the exporter. Additionally each transport needs to be told where to send test data. This is transport-dependent; things like a HTTP endpoint, IP address, port are good examples.
Send data somewhere.
Parameters: |
|
---|---|
Raises: |
|
Returns: | a dictionary with additional items, see notes below |
Note
The return value is especially vague specifically to allow various transports to express whatever they may need to express for a particular vertical use case yet still to allow most of the code to just work with all transports.
It is expected that certain keys in the returned dictionary will gain special semantics that can be further standardized. As of this writing there are no standard keys.
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.