avocado.core.dependencies.requirements.cache.backends package

Submodules

avocado.core.dependencies.requirements.cache.backends.sqlite module

Test requirements module.

avocado.core.dependencies.requirements.cache.backends.sqlite.CACHE_DATABASE_PATH = '/home/cleber/avocado/data/cache/requirements.sqlite'

The location of the requirements cache database

avocado.core.dependencies.requirements.cache.backends.sqlite.SCHEMA = ['CREATE TABLE IF NOT EXISTS requirement_type (requirement_type TEXT UNIQUE)', 'CREATE TABLE IF NOT EXISTS environment_type (environment_type TEXT UNIQUE)', 'CREATE TABLE IF NOT EXISTS environment (environment_type TEXT,environment TEXT,FOREIGN KEY(environment_type) REFERENCES environment_type(environment_type))', 'CREATE UNIQUE INDEX IF NOT EXISTS environment_idx ON environment (environment, environment_type)', 'CREATE TABLE IF NOT EXISTS requirement (environment_type TEXT,environment TEXT,requirement_type TEXT,requirement TEXT,saved BOOLEAN,FOREIGN KEY(environment_type) REFERENCES environment(environment_type),FOREIGN KEY(environment) REFERENCES environment(environment),FOREIGN KEY(requirement_type) REFERENCES requirement_type(requirement_type))', 'CREATE UNIQUE INDEX IF NOT EXISTS requirement_idx ON requirement (environment_type, environment, requirement_type, requirement)']

The definition of the database schema

avocado.core.dependencies.requirements.cache.backends.sqlite.delete_environment(environment_type, environment)

Deletes environment with all its requirements from cache.

Parameters
  • environment_type (str) – Type of environment

  • environment (str) – Environment which will be deleted

avocado.core.dependencies.requirements.cache.backends.sqlite.delete_requirement(environment_type, environment, requirement_type, requirement)

Deletes requirement from cache.

Parameters
  • environment_type (str) – Type of environment

  • environment (str) – Environment where the requirement is.

  • requirement_type (str) – Type of the requirement in environment

  • requirement (str) – Name of requirement which will be deleted

avocado.core.dependencies.requirements.cache.backends.sqlite.get_all_environments_with_requirement(environment_type, requirement_type, requirement)

Fetches all environments with selected requirement from cache.

Parameters
  • environment_type (str) – Type of fetched environment

  • requirement_type (str) – Type of the requirement in environment

  • requirement (str) – Name of requirement

Returns

Dict with all environments which has selected requirements.

avocado.core.dependencies.requirements.cache.backends.sqlite.get_all_requirements()

Fetches all requirements from database.

Returns

Dict with all environments which has requirements.

avocado.core.dependencies.requirements.cache.backends.sqlite.is_environment_prepared(environment)

Checks if environment has all requirements saved.

avocado.core.dependencies.requirements.cache.backends.sqlite.is_requirement_in_cache(environment_type, environment, requirement_type, requirement)

Checks if requirement is in cache.

Return type

True if requirement is in cache False if requirement is not in cache None if requirement is in cache but it is not saved yet.

avocado.core.dependencies.requirements.cache.backends.sqlite.set_requirement(environment_type, environment, requirement_type, requirement, saved=True)
avocado.core.dependencies.requirements.cache.backends.sqlite.update_environment(environment_type, old_environment, new_environment)

Updates environment information for each requirement in one environment.

It will remove the old environment and add the new one to the cache.

Parameters
  • environment_type (str) – Type of fetched environment

  • old_environment – Environment which should be updated

  • new_environment – Environment, which will be a reimbursement for the old one.

avocado.core.dependencies.requirements.cache.backends.sqlite.update_requirement_status(environment_type, environment, requirement_type, requirement, new_status)

Updates status of selected requirement in cache.

The status has two values, save=True or not_save=False.

Parameters
  • environment_type (str) – Type of fetched environment

  • environment (str) – Environment where the requirement is

  • requirement_type (str) – Type of the requirement in environment

  • requirement (str) – Name of requirement

  • new_status (bool) – Requirement status which will be updated

Module contents