Skip to content

Commit 7f3477d

Browse files
author
Jairo Llopis
committed
Increase timeout for pexpect and use yaml.load_safe
1 parent 0b8a9a9 commit 7f3477d

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

tests/test_complex_questions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def test_cli_interactive(tmp_path):
5050
"Invalid value",
5151
"please try again",
5252
]
53-
tui = pexpect.spawn("copier", ["copy", SRC, str(tmp_path)], timeout=3)
53+
tui = pexpect.spawn("copier", ["copy", SRC, str(tmp_path)], timeout=5)
5454
tui.expect_exact(["I need to know it. Do you love me?", "love_me", "Format: bool"])
5555
tui.send("y")
5656
tui.expect_exact(["Please tell me your name.", "your_name", "Format: str"])
@@ -192,7 +192,7 @@ def test_cli_interatively_with_flag_data_and_type_casts(tmp_path: Path):
192192
SRC,
193193
str(tmp_path),
194194
],
195-
timeout=3,
195+
timeout=5,
196196
)
197197

198198
tui.expect_exact(["I need to know it. Do you love me?", "love_me", "Format: bool"])

tests/test_migrations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def test_prereleases(tmp_path: Path):
181181
git("tag", "v2.0.0.alpha1")
182182
# Copying with use_prereleases=False copies v1
183183
copy(src_path=str(src), dst_path=dst, force=True)
184-
answers = yaml.load((dst / ".copier-answers.yml").read_text())
184+
answers = yaml.load_safe((dst / ".copier-answers.yml").read_text())
185185
assert answers["_commit"] == "v1.0.0"
186186
assert (dst / "version.txt").read_text() == "v1.0.0"
187187
assert not (dst / "v1.9").exists()
@@ -204,7 +204,7 @@ def test_prereleases(tmp_path: Path):
204204
assert not (dst / "v2.a2").exists()
205205
# Update it with prereleases
206206
copy(dst_path=dst, force=True, use_prereleases=True)
207-
answers = yaml.load((dst / ".copier-answers.yml").read_text())
207+
answers = yaml.load_safe((dst / ".copier-answers.yml").read_text())
208208
assert answers["_commit"] == "v2.0.0.alpha1"
209209
assert (dst / "version.txt").read_text() == "v2.0.0.alpha1"
210210
assert (dst / "v1.9").exists()

tests/test_prompt.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def test_copy_default_advertised(tmp_path_factory, name):
7777
git("add", ".")
7878
assert "_commit: v1" in Path(".copier-answers.yml").read_text()
7979
git("commit", "-m", "v1")
80-
tui = pexpect.spawn("copier", timeout=3)
80+
tui = pexpect.spawn("copier", timeout=5)
8181
# Check what was captured
8282
tui.expect_exact(["in_love?", "Format: bool", "(Y/n)"])
8383
tui.sendline()
@@ -138,7 +138,7 @@ def test_when(tmp_path_factory, question_2_when, asks):
138138
tui.expect_exact(["question_2?", "Format: yaml"])
139139
tui.sendline()
140140
tui.expect_exact(pexpect.EOF)
141-
answers = yaml.load((subproject / ".copier-answers.yml").read_text())
141+
answers = yaml.load_safe((subproject / ".copier-answers.yml").read_text())
142142
assert answers == {
143143
"_src_path": str(template),
144144
"question_1": True,
@@ -176,7 +176,7 @@ def test_placeholder(tmp_path_factory):
176176
)
177177
tui.sendline()
178178
tui.expect_exact(pexpect.EOF)
179-
answers = yaml.load((subproject / ".copier-answers.yml").read_text())
179+
answers = yaml.load_safe((subproject / ".copier-answers.yml").read_text())
180180
assert answers == {
181181
"_src_path": str(template),
182182
"question_1": "answer 1",

tests/test_templated_prompt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def test_templated_prompt(
136136
tui.expect_exact([f"{question_name}?"] + expected_outputs)
137137
tui.sendline()
138138
tui.expect_exact(pexpect.EOF)
139-
answers = yaml.load((subproject / ".copier-answers.yml").read_text())
139+
answers = yaml.load_safe((subproject / ".copier-answers.yml").read_text())
140140
assert answers[question_name] == expected_value
141141

142142

0 commit comments

Comments
 (0)