Skip to content

Commit

Permalink
BarrierTest: Keep queue flushing
Browse files Browse the repository at this point in the history
This will keep the queue flushing its contents so FIFO behaviour is
emulated.
  • Loading branch information
sils committed May 13, 2015
1 parent 2dbd0d8 commit a87ccdc
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions coalib/tests/processes/BarrierTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@ def test_barrier(self):
args=(queue, uut))]
for proc in processes:
proc.start()

# Order will probably be wrong (1 2 1 2) if barrier doesn't work
for expected in [1, 1, 2, 2]:
self.assertEqual(queue.get(), expected)

for proc in processes:
proc.join()

# Order will be wrong (1 2 1 2) if barrier doesn't work
self.assertEqual(queue.get(), 1)
self.assertEqual(queue.get(), 1)
self.assertEqual(queue.get(), 2)
self.assertEqual(queue.get(), 2)


if __name__ == '__main__':
unittest.main(verbosity=2)

0 comments on commit a87ccdc

Please sign in to comment.