Skip to content

Commit 579a95f

Browse files
committed
Update test
1 parent 13c8199 commit 579a95f

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/ansible_dev_environment/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ def isolation_cfg(self) -> bool:
126126
self.output.error(err)
127127
hint = "Run `unset ANSIBLE_CONFIG` to unset it using cfg isolation mode."
128128
self.output.hint(hint)
129+
self.acfg_trusted = None
129130
return False
130131

131132
if self.acfg_cwd.exists:

tests/unit/test_cli_isolation.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ def init_cli(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Cli:
4949

5050
cli = Cli()
5151
cli.args = ARGS
52-
cli.acfg_cwd = AnsibleCfg(path=tmp_path / "ansible.cfg")
53-
cli.acfg_home = AnsibleCfg(path=tmp_path / "ansible.cfg")
54-
cli.acfg_system = AnsibleCfg(path=tmp_path / "ansible.cfg")
52+
cli.acfg_cwd = AnsibleCfg(path=cwd / "ansible.cfg")
53+
cli.acfg_home = AnsibleCfg(path=home / "ansible.cfg")
54+
cli.acfg_system = AnsibleCfg(path=system / "ansible.cfg")
5555
cli.init_output()
5656
return cli
5757

@@ -163,17 +163,20 @@ def test_invalid_isolation_mode(cli: Cli) -> None:
163163

164164

165165
def test_isolation_cfg_with_env_var(
166-
cli: Cli,
167166
monkeypatch: pytest.MonkeyPatch,
168167
tmp_path: Path,
169168
) -> None:
170169
"""Test isolation_cfg method with ANSIBLE_CONFIG environment variable.
171170
172171
Args:
173-
cli: A Cli instance from a fixture
174172
monkeypatch: Pytest fixture for monkey patching.
175173
tmp_path: Pytest fixture for temporary file paths.
176174
"""
175+
cli = Cli()
176+
cli.args = ARGS
177+
cli.init_output()
178+
177179
monkeypatch.setenv("ANSIBLE_CONFIG", str(tmp_path / "ansible.cfg"))
180+
178181
assert cli.isolation_check() is False
179-
assert not hasattr(cli, "acfg_trusted")
182+
assert cli.acfg_trusted is None

0 commit comments

Comments
 (0)