<#2836 `.env` not loaded when running built-in tes...
# meltano-repo-activity
g
#2836 `.env` not loaded when running built-in tests Issue created by ReubenFrankel
I think I'm missing something since I can confirm that the
.env
is loaded when running tests:
sdk/singer_sdk/testing/factory.py
Lines 99 to 100 in</meltano/sdk/commit/d1ba40003a516c8d0c42b9fd81ca8a826de3d392|d1ba400>
| if "parse_env_config" not in kwargs: |
| ------------------------------------ |
| kwargs["parse_env_config"] = True |
and then
sdk/singer_sdk/plugin_base.py
Lines 191 to 193 in</meltano/sdk/commit/d1ba40003a516c8d0c42b9fd81ca8a826de3d392|d1ba400>
| if parse_env_config: |
| ---------------------------------------------------------- |
| self.logger.info("Parsing env var for settings config...") |
| config_dict.update(self._env_var_config) |
and
sdk/singer_sdk/plugin_base.py
Lines 271 to 284 in</meltano/sdk/commit/d1ba40003a516c8d0c42b9fd81ca8a826de3d392|d1ba400>
| @classproperty |
| ----------------------------------------------------------------------- |
| def _env_var_config(cls) -> dict[str, t.Any]: # noqa: N805 |
| """Return any config specified in environment variables. |
| |
| Variables must match the convention "<PLUGIN_NAME>_<SETTING_NAME>", |
| all uppercase with dashes converted to underscores. |
| |
| Returns: |
| Dictionary of configuration parsed from the environment. |
| """ |
| config_jsonschema = cls.config_jsonschema |
| cls.append_builtin_config(config_jsonschema) |
| |
| return parse_environment_config(config_jsonschema, cls._env_var_prefix) |
If you run pytest with the
-s
flag, you should be able to see something like
```
2025-01-21 110925,719 | INFO | singer_sdk.configuration._dict_config | Parsing 'account_id' config from env variable 'TAP_CHECKLY_ACCOUNT_ID'.
2025-01-21 110925,719 | INFO | singer_sdk.configuration._dict_config | Parsing 'token' config from env variable 'TAP_CHECKLY_TOKEN'.
```
even though the env vars are not set in the shell where this is running.
Originally posted by @edgarrmondragon in #2835 (comment) meltano/sdk