Skip to content

Commit b9e3719

Browse files
committed
Fixing flaky test.
1 parent d15c9a8 commit b9e3719

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/test_terminal.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# stdlib
22
import json
33
import os
4+
import re
45
import sys
56

67
# 3rd party
@@ -146,22 +147,21 @@ def test_echo(capsys):
146147
employer = fake.company()
147148
telephone = fake.phone_number()
148149
alive = fake.pybool()
149-
other = fake.pydict()
150+
z_other = fake.pydict()
150151

151152
captured = capsys.readouterr()
152153
stdout = captured.out.split("\n")
153-
print(stdout)
154154

155155
assert stdout[0] == " {{'address': '{}',".format(address.replace("\n", "\\n"))
156156
assert stdout[1] == f" 'alive': {alive},"
157157
assert stdout[2] == f" 'employer': '{employer}',"
158158
assert stdout[3] == f" 'iban': '{iban}',"
159159
assert stdout[4] == f" 'ip_address': '{ip_address}',"
160160
assert stdout[5] == f" 'name': '{name}',"
161-
assert stdout[6].startswith(" 'other': {")
162-
assert stdout[6].endswith(",")
163-
for line in range(7, 13, 1):
164-
assert stdout[line].startswith(" '")
165-
assert stdout[line].endswith(",")
166-
assert stdout[-2] == f" 'telephone': '{telephone}'}}"
161+
assert stdout[6] == f" 'telephone': '{telephone}',"
162+
assert stdout[7].startswith(" 'z_other': {")
163+
assert stdout[7].endswith(",")
164+
for line in range(8, 13, 1):
165+
assert re.match(r"^\s*'.*':.*[,}]$", stdout[line])
166+
assert stdout[-2].endswith("}")
167167
assert stdout[-1] == ''

0 commit comments

Comments
 (0)