Set the default testharness config from environment (#8050)

This commit is contained in:
Andrew Noyes 2022-08-31 07:07:59 -07:00 committed by GitHub
parent 9fb45f349f
commit 4bdf94141e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -234,7 +234,10 @@ class Config:
assert type(None) != attr_type
e = os.getenv(env_name)
if e is not None:
self.__setattr__(attr, attr_type(e))
# Use the env var to supply the default value, so that if the
# environment variable is set and the corresponding command line
# flag is not, the environment variable has an effect.
self._config_map[attr].kwargs['default'] = attr_type(e)
def build_arguments(self, parser: argparse.ArgumentParser):
for val in self._config_map.values():