esptest.config.env_config module

esptest.config.env_config.get_variable_from_env(key)[source]

Get test variable from shell environment

Parameters:

key (str) – which variable to get

Return type:

Any

class esptest.config.env_config.EnvConfig(env_tag='default', config_file=None)[source]

Bases: object

Get test environment variables from config file.

By default the config file is named “EnvConfig.yml” and put in one of those folders:
  • env variables: TEST_ENV_CONFIG_DIR

  • Current working directory

  • project root directory

  • ci-test-runner-configs (with runner description) under project root directory

  • <HOME>/test_env_config/ # non-win32

Support input variables from console if run tests locally other than CI.

Example usage:

`python env_config = EnvConfig(env_tag='my_env') var1 = env_config.get_variable('var1') `

Parameters:
  • env_tag (str)

  • config_file (str | None)

ENV_CONFIG_FILE_BASE_NAME = 'EnvConfig.yml'
TEST_ENV_CONFIG_FILE = ''
PROJECT_ROOT_DIR = ''
DISABLE_LOAD_SHELL_ENV = False
ALLOW_INPUT = True
get_variable(key, default=None)[source]

Get environment variable

Parameters:
  • key (str) – which variable to get

  • default (Any, optional) – default variable if the key not in config file.

Raises:

ValueError – raise Error if the key is not in config file and default is not given.

Returns:

variable value

Return type:

Any