ci_exec.parsers.utils¶
Helper routines for any custom ci_exec.parsers
.
In a nested module to avoid any circular import problems.
- env_or_platform_default(*, env, windows, darwin, other)[source]¶
Return either the environment variable or the specified platform default.
Convenience routine to check
os.getenv()
forenv
variable, and if not found checkplatform.system()
and return the default. Example:env_or_platform_default(env="CC", windows="cl.exe", darwin="clang", other="gcc")
Only used to avoid writing the same conditional structure repeatedly.
- Parameters
env (str) – The environment variable to check for first. If it is set in the environment, it will be returned.
windows (str) – Returned if
env
not set, andplatform.system()
returns"Windows"
.darwin (str) – Returned if
env
not set andplatform.system()
returns"Darwin"
.other (str) – Returned if
env
not set andplatform.system()
is neither"Windows"
nor"Darwin"
.
Tests¶
Tests for the ci_exec.parsers.utils
module.
- test_env_or_platform_default()[source]¶
Validate
env_or_platform_default()
returns expected values for each platform.