gc3libs.testing.helpers

Utility functions for use in unit test code.

class gc3libs.testing.helpers.SimpleParallelTaskCollection(num_tasks, **extra_args)
class gc3libs.testing.helpers.SimpleSequentialTaskCollection(num_tasks, **extra_args)
class gc3libs.testing.helpers.SuccessfulApp(name='success', **extra_args)

An application instance reporting always a zero exit code.

terminated()

Called when the job state transitions to TERMINATED, i.e., the job has finished execution (with whatever exit status, see returncode) and the final output has been retrieved.

The location where the final output has been stored is available in attribute self.output_dir.

The default implementation does nothing, override in derived classes to implement additional behavior.

class gc3libs.testing.helpers.UnsuccessfulApp(name='fail', **extra_args)

An application reporting always a non-zero exit code.

terminated()

Called when the job state transitions to TERMINATED, i.e., the job has finished execution (with whatever exit status, see returncode) and the final output has been retrieved.

The location where the final output has been stored is available in attribute self.output_dir.

The default implementation does nothing, override in derived classes to implement additional behavior.

gc3libs.testing.helpers.example_cfg_dict()

Write a GC3Pie configuration into a Python dictionary.

gc3libs.testing.helpers.temporary_config(cfgtext=None)

Return a GC3Pie Configuration object.

Optional argument cfgtext holds the contents of the configuration file to use. If not given, a default one will be used.

gc3libs.testing.helpers.temporary_config_file(cfgtext=None, keep=False)

Write a GC3Pie configuration into a temporary file.

Yields an open file object pointing to the configuration file. Its .name attribute holds the file path in the filesystem.

gc3libs.testing.helpers.test_resource(name='test', **params)

Yield a GC3Pie configuration containing a single resource, built using the given parameters.

The only resource is named test (can be changed by passing keyword argument name).

Note

The parameters must be given in the internal format expected by the backend “LRMS” constructors, not in the string format expected by the configuration file parser.