# Tai Sakuma <tai.sakuma@gmail.com>
import pytest
import time
import multiprocessing

try:
    import unittest.mock as mock
except ImportError:
    import mock

from alphatwirl.progressbar import ProgressReportPickup

##__________________________________________________________________||
class MockPresentation(object):
    def __init__(self): self.reports = [ ]
    def present(self, report): self.reports.append(report)
    def nreports(self): return 0

##__________________________________________________________________||
class MockReport(object): pass

##__________________________________________________________________||
def test_start_join():
    queue = multiprocessing.Queue()
    presentation = MockPresentation()
    pickup = ProgressReportPickup(queue, presentation)
    pickup.start()
    queue.put(None)
    pickup.join()

##__________________________________________________________________||

@@ -450,16 +450,257 @@
 turn 0%0A%0A
+@pytest.fixture()%0Adef presentation():%0A    return MockPresentation()%0A%0A@pytest.fixture()%0Adef queue():%0A    return multiprocessing.Queue()%0A%0A@pytest.fixture()%0Adef pickup(queue, presentation):%0A    return ProgressReportPickup(queue, presentation)%0A%0A
 ##______
@@ -889,119 +889,16 @@
 oin(
-):%0A    queue = multiprocessing.Queue()%0A    presentation = MockPresentation()%0A    pickup = ProgressReportPickup(
+pickup, 
 queu
@@ -913,16 +913,17 @@
 ntation)
+:
 %0A    pic

update test_ProgressReportPickup.py