Skip to content

Commit f3e3fb3

Browse files
committed
@GitHK review: doc
1 parent db5ee3c commit f3e3fb3

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/pytest-simcore/src/pytest_simcore/environment_configs.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ def pytest_addoption(parser: pytest.Parser):
2828

2929

3030
@pytest.fixture(scope="session")
31-
def external_envfile_dict(request: pytest.FixtureRequest) -> EnvVarsDict:
31+
def external_envfile_dict(
32+
request: pytest.FixtureRequest, osparc_simcore_root_dir: Path
33+
) -> EnvVarsDict:
3234
"""
3335
If a file under test folder prefixed with `.env-secret` is present,
3436
then this fixture captures it.
@@ -46,9 +48,15 @@ def external_envfile_dict(request: pytest.FixtureRequest) -> EnvVarsDict:
4648
assert envfile.exists()
4749
assert envfile.is_file()
4850

49-
if not any(term in envfile.name.lower() for term in ("ignore", "secret")):
51+
envfile = envfile.resolve()
52+
osparc_simcore_root_dir = osparc_simcore_root_dir.resolve()
53+
54+
if osparc_simcore_root_dir in envfile.parents and not any(
55+
term in envfile.name.lower() for term in ("ignore", "secret")
56+
):
5057
_logger.warning(
51-
"🚨 CAUTION: The provided envfile '%s' might be pushed in this repository. Please rename it with `secret` or `ignore`",
58+
"🚨 CAUTION: The file '%s' from '--external-envfile' may be versioned and exposed publicly. "
59+
"Add 'secret' or 'ignore' to the filename to exclude it automatically.",
5260
envfile.name,
5361
)
5462

0 commit comments

Comments
 (0)