Repo - Utility class for testing source plugins

class Repo

Bases: object

Abstract class providing scaffolding for generating data to be used with various sources. Subclasses of Repo may be registered to run through the suite of generic source plugin tests provided in buildstream.testing.

Args: directory (str): The base temp directory for the test subdir (str): The subdir for the repo, in case there is more than one

create(directory)

Create a repository in self.directory and add the initial content

Parameters

directory – A directory with content to commit

Returns

A new ref corresponding to this commit, which can

be passed as the ref in the Repo.source_config() API.

Return type

(smth)

source_config(ref=None)
Parameters

ref (smth) – An optional abstract ref object, usually a string.

Returns

A configuration which can be serialized as a

source when generating an element file on the fly

Return type

(dict)

copy_directory(src, dest)

Copies the content of src to the directory dest

Like shutil.copytree(), except dest is expected to exist.

Parameters
  • src (str) – The source directory

  • dest (str) – The destination directory

copy(dest)

Creates a copy of this repository in the specified destination.

Args: dest (str): The destination directory

Returns: (Repo): A Repo object for the new repository.