Skip to content

Commit

Permalink
Merge pull request #591 from sroet/fix_flaky_test
Browse files Browse the repository at this point in the history
fix flaky test
  • Loading branch information
ecederstrand committed Nov 12, 2021
2 parents 2bb7d94 + 29edf3f commit 0bb9093
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1493,14 +1493,16 @@ def test_general_signal(self):
import time
import signal
i = 0
def sig_handler(sig, frame):
print(10)
exit(0)
global i
i = 42
signal.signal(signal.SIGINT, sig_handler)
for i in range(5):
for _ in range(6):
print(i)
i += 1
sys.stdout.flush()
time.sleep(0.5)
""")
Expand All @@ -1518,7 +1520,7 @@ def agg(line, stdin, process):
p.wait()

self.assertEqual(p.process.exit_code, 0)
self.assertEqual(p, "0\n1\n2\n3\n10\n")
self.assertEqual(p, "0\n1\n2\n3\n42\n43\n")

def test_iter_generator(self):
py = create_tmp_test("""
Expand Down

0 comments on commit 0bb9093

Please sign in to comment.