Skip to content

Commit a84ac58

Browse files
authored
Merge branch 'main' into fix_uv
2 parents 172b22c + a8ecbac commit a84ac58

File tree

8 files changed

+18
-5
lines changed

8 files changed

+18
-5
lines changed

.env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
# PWD is supposed to be the directory container the .envrc file based on the
3+
# specs. This trick should isolate our testing from user environment.
4+
ANSIBLE_HOME=$PWD/.ansible
5+
ANSIBLE_CONFIG=$PWD/ansible.cfg

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ celerybeat.pid
120120
*.sage.py
121121

122122
# Environments
123-
.env
124123
.venv
125124
env/
126125
venv/
@@ -170,3 +169,4 @@ cython_debug/
170169

171170
.DS_Store
172171
_readthedocs/
172+
.ansible

.tool-versions

Lines changed: 0 additions & 2 deletions
This file was deleted.

ansible.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[defaults]
2+
# isolate project testing from user local setup
3+
collections_path = .

mise.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[tools]
2+
python = "3.13"

src/ansible_dev_environment/cli.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,14 @@ def ensure_isolated(self) -> None:
109109
self.output.hint(hint)
110110
errored = True
111111

112-
home_coll = Path.home() / ".ansible/collections/ansible_collections"
112+
home_coll = (
113+
Path(os.environ.get("ANSIBLE_HOME", "~/.ansible")).expanduser()
114+
/ "collections/ansible_collections"
115+
)
113116
if home_coll.exists() and tuple(home_coll.iterdir()):
114117
err = f"Collections found in {home_coll}"
115118
self.output.error(err)
116-
hint = "Run `rm -rf ~/.ansible/collections` to remove them."
119+
hint = f"Run `rm -rf {home_coll}` to remove them or configure ANSIBLE_HOME to point to a different location."
117120
self.output.hint(hint)
118121
errored = True
119122

tests/unit/test_cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ def test_collections_in_home(
161161
["ansible-dev-environment", "install", "--venv", "venv"],
162162
)
163163
monkeypatch.setenv("HOME", str(tmp_path))
164+
monkeypatch.setenv("ANSIBLE_HOME", str(tmp_path / ".ansible"))
164165
collection_root = tmp_path / ".ansible" / "collections" / "ansible_collections"
165166
(collection_root / "ansible" / "utils").mkdir(parents=True)
166167
with pytest.raises(SystemExit):

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package = editable
1818
extras =
1919
test
2020
pass_env =
21+
ANSIBLE_*
2122
CI
2223
CONTAINER_*
2324
DOCKER_*

0 commit comments

Comments
 (0)