Skip to content

Commit

Permalink
Updated tests to reflect reality
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesra committed Apr 13, 2022
1 parent 2211525 commit 2a383a8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions nornir_pools/poolbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,12 @@ def remove_finished_threads(self):


def wait_completion(self):
"""Wait for completion of all the tasks in the queue"""
"""Wait for completion of all the tasks in the queue.
Note that wait or wait_return must be called on
each task to detect exceptions if there were any
"""

self.tasks.join()

self.tasks.join()
self.remove_finished_threads()

4 changes: 3 additions & 1 deletion test/test_nornir_pools.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,14 @@ def VerifyExceptionBehaviour(test, pool):
try:
task = pool.add_task(exceptText, RaiseException, exceptText)
pool.wait_completion()

task.wait();
except IntentionalPoolException as e:
print("Correctly found exception in thread\n" + str(e))
ExceptionFound = True
pass

test.assertTrue(ExceptionFound, "wait_return: No exception reported when raised in thread and pool.wait_completion called")
test.assertTrue(ExceptionFound, "wait_completion: No exception reported when raised in thread and pool.wait_completion called")


def SquareTheNumberWithDelay(num):
Expand Down

0 comments on commit 2a383a8

Please sign in to comment.