AppHarness: disable telemetry for test apps (#1733)
This commit is contained in:
parent
63b5fbd7b0
commit
ca4724cec8
@ -245,7 +245,11 @@ class Config(Base):
|
||||
|
||||
# Convert the env var to the expected type.
|
||||
try:
|
||||
env_var = field.type_(env_var)
|
||||
if issubclass(field.type_, bool):
|
||||
# special handling for bool values
|
||||
env_var = env_var.lower() in ["true", "1", "yes"]
|
||||
else:
|
||||
env_var = field.type_(env_var)
|
||||
except ValueError:
|
||||
console.error(
|
||||
f"Could not convert {key.upper()}={env_var} to type {field.type_}"
|
||||
|
@ -141,6 +141,7 @@ class AppHarness:
|
||||
)
|
||||
|
||||
def _initialize_app(self):
|
||||
os.environ["TELEMETRY_ENABLED"] = "" # disable telemetry reporting for tests
|
||||
self.app_path.mkdir(parents=True, exist_ok=True)
|
||||
if self.app_source is not None:
|
||||
# get the source from a function or module object
|
||||
|
@ -54,6 +54,8 @@ def test_deprecated_params(base_config_values, param):
|
||||
("DB_URL", "postgresql://user:pass@localhost:5432/db"),
|
||||
("REDIS_URL", "redis://localhost:6379"),
|
||||
("TIMEOUT", 600),
|
||||
("TELEMETRY_ENABLED", False),
|
||||
("TELEMETRY_ENABLED", True),
|
||||
],
|
||||
)
|
||||
def test_update_from_env(base_config_values, monkeypatch, env_var, value):
|
||||
|
Loading…
Reference in New Issue
Block a user