Skip to content

Commit b2d4620

Browse files
authored
Improve default .gitignore (#358)
- Adds .DS_Store which is created by MacOS - Adds .ansible which is ansible temp directory
1 parent 3d6251c commit b2d4620

File tree

4 files changed

+27
-9
lines changed

4 files changed

+27
-9
lines changed

src/ansible_creator/resources/common/gitignore/.gitignore.j2

+6
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,9 @@ cython_debug/
159159
# and can be added to the global gitignore or merged into this file. For a more nuclear
160160
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
161161
#.idea/
162+
163+
# MacOS
164+
.DS_Store
165+
166+
# Ansible
167+
.ansible/

tests/fixtures/collection/testorg/testcol/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,9 @@ cython_debug/
159159
# and can be added to the global gitignore or merged into this file. For a more nuclear
160160
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
161161
#.idea/
162+
163+
# MacOS
164+
.DS_Store
165+
166+
# Ansible
167+
.ansible/

tests/fixtures/project/playbook_project/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,9 @@ cython_debug/
169169
# and can be added to the global gitignore or merged into this file. For a more nuclear
170170
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
171171
#.idea/
172+
173+
# MacOS
174+
.DS_Store
175+
176+
# Ansible
177+
.ansible/

tests/units/test_init.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ def mock_unique_name_in_devfile(init: Init) -> str:
126126
result = capsys.readouterr().out
127127

128128
# check stdout
129-
assert re.search("Note: collection project created", result) is not None
129+
assert re.search(r"Note: collection project created", result) is not None
130130

131131
# recursively assert files created
132-
cmp = dircmp(str(tmp_path), str(FIXTURES_DIR / "collection"))
132+
cmp = dircmp(str(tmp_path), str(FIXTURES_DIR / "collection"), ignore=[".DS_Store"])
133133
diff = has_differences(dcmp=cmp, errors=[])
134134
assert diff == [], diff
135135

@@ -152,12 +152,12 @@ def mock_unique_name_in_devfile(init: Init) -> str:
152152
result = capsys.readouterr().out
153153
assert (
154154
re.search(
155-
"already exists",
155+
r"already exists",
156156
result,
157157
)
158158
is not None
159159
), result
160-
assert re.search("Note: collection project created at", result) is not None, result
160+
assert re.search(r"Note: collection project created at", result) is not None, result
161161

162162
# override existing collection with force=true
163163
cli_args["force"] = True
@@ -166,7 +166,7 @@ def mock_unique_name_in_devfile(init: Init) -> str:
166166
)
167167
init.run()
168168
result = capsys.readouterr().out
169-
assert re.search("Warning: re-initializing existing directory", result) is not None, result
169+
assert re.search(r"Warning: re-initializing existing directory", result) is not None, result
170170

171171

172172
def test_run_success_ansible_project(
@@ -209,7 +209,7 @@ def mock_unique_name_in_devfile(init: Init) -> str:
209209
result = capsys.readouterr().out
210210

211211
# check stdout
212-
assert re.search("Note: playbook project created", result) is not None
212+
assert re.search(r"Note: playbook project created", result) is not None
213213

214214
# recursively assert files created
215215
cmp = dircmp(
@@ -238,12 +238,12 @@ def mock_unique_name_in_devfile(init: Init) -> str:
238238
result = capsys.readouterr().out
239239
assert (
240240
re.search(
241-
"already exists",
241+
r"already exists",
242242
result,
243243
)
244244
is not None
245245
), result
246-
assert re.search("Note: playbook project created at", result) is not None, result
246+
assert re.search(r"Note: playbook project created at", result) is not None, result
247247

248248
# override existing playbook directory with force=true
249249
cli_args["force"] = True
@@ -252,7 +252,7 @@ def mock_unique_name_in_devfile(init: Init) -> str:
252252
)
253253
init.run()
254254
result = capsys.readouterr().out
255-
assert re.search("Warning: re-initializing existing directory", result) is not None, result
255+
assert re.search(r"Warning: re-initializing existing directory", result) is not None, result
256256

257257

258258
def test_run_success_collections_alt_dir(

0 commit comments

Comments
 (0)