Skip to content

Commit f936d7c

Browse files
committed
fix tests
1 parent 5cd07e9 commit f936d7c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/tests.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ def check_text(html, help_txt, txt_number=0, threshold=0.95):
248248
for element in ["<pre>", "<span>", "</span>", "</pre>"]:
249249
txt = txt.strip(element)
250250
assert txt is not None
251-
assert similarity(txt, help_txt) > threshold
251+
sim = similarity(txt, help_txt)
252+
assert sim > threshold, f"{sim} is below threshold {threshold}"
252253
return txt
253254

254255

@@ -579,6 +580,11 @@ def test_click_ex_imagepipe():
579580

580581

581582
def test_typer_ex_composite():
583+
EX_DIR = TYPER_EXAMPLES / "composite/composite"
584+
cli_py = EX_DIR / "cli.py"
585+
group_py = EX_DIR / "group.py"
586+
echo_py = EX_DIR / "echo.py"
587+
582588
try:
583589
clear_callbacks()
584590

@@ -609,7 +615,6 @@ def test_build(first=False):
609615

610616
return doc_helps
611617

612-
EX_DIR = TYPER_EXAMPLES / "composite/composite"
613618
index_html = TYPER_EXAMPLES / "composite/build/html/index.html"
614619
composite_html = TYPER_EXAMPLES / "composite/build/html/composite.html"
615620
echo_html = TYPER_EXAMPLES / "composite/build/html/echo.html"
@@ -631,10 +636,6 @@ def test_build(first=False):
631636
times2 = [pth.stat().st_mtime for pth in files]
632637
assert times == times2, "Rebuild was not cached!"
633638

634-
cli_py = EX_DIR / "cli.py"
635-
group_py = EX_DIR / "group.py"
636-
echo_py = EX_DIR / "echo.py"
637-
638639
# test that
639640
replace_in_file(
640641
cli_py, "Lets do stuff with strings.", "XX Lets do stuff with strings. XX"

0 commit comments

Comments
 (0)