-
Notifications
You must be signed in to change notification settings - Fork 218
Open
Milestone
Description
In easybuilders/easybuild-easyblocks#4003, we ran into a case where os.getenv() was being used a little carelessly (not providing a default value which lead to a None being injected into the build command). In general I think a framework function would be useful for this to reduce/remove the need for generic testing. There are a couple of cases that would be nice to cover:
- the environment variable may or may not exist (
get_environment_variable("VAR"), returns value or'') - the environment variable must be defined (
get_environment_variable("VAR", required=True), returns value or errors) - the environment variable if exists should be non-empty (
get_environment_variable("VAR", empty=False)) - the environment variable should exist and be non-empty (
get_environment_variable("VAR", empty=False, required=True))