Skip to content

Commit

Permalink
fix queue test
Browse files Browse the repository at this point in the history
  • Loading branch information
GreatYYX committed Jul 14, 2020
1 parent 88fc0b6 commit a78559f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pyrallel/tests/test_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@


def f(iq, oq):
while True:
try:
try:
while True:
oq.put(iq.get(timeout=2))
except queue.Empty:
return
except queue.Empty:
return


def test_shmqueue():
if not hasattr(pyrallel, 'ShmQueue'):
return

mp.set_start_method('fork')
ShmQueueCls = getattr(pyrallel, 'ShmQueue')
sq = ShmQueueCls(chunk_size=1024 * 4, maxsize=5)
q = mp.Queue()
Expand All @@ -26,7 +27,7 @@ def test_shmqueue():
items = list(range(10))

for i in items:
q.put(i)
sq.put(i)

while True:
try:
Expand All @@ -37,4 +38,5 @@ def test_shmqueue():

p1.join()
p2.join()
sq.close()
q.close()

0 comments on commit a78559f

Please sign in to comment.