isee.common¶
This module contains common functions that are used in multiple modules.
Functions:
git: Execute a git command and return the output.
get_env_var: Get the value of an environment variable.
get_file_path: Get the file path of a file in a directory.
Functions
|
Get the value of an environment variable. |
|
|
|
Execute a git command and return the output. |
- isee.common.get_env_var(key)[source]¶
Get the value of an environment variable. If the variable is not defined or is empty, raise a RuntimeError.
- Parameters:
key – The name of the environment variable.
- Returns:
The value of the environment variable.
- Raises:
RuntimeError – If the environment variable is not defined or is empty.
>>> import os >>> os.environ['TEST'] = 'test' >>> get_env_var('TEST') 'test'
>>> get_env_var('TEST2') Traceback (most recent call last): ... RuntimeError: TEST2 is not defined or is empty!
>>> os.environ['TEST3'] = '' >>> get_env_var('TEST3') Traceback (most recent call last): ... RuntimeError: TEST3 is not defined or is empty!