Skip to content
Permalink
Browse files

rename createReporter() create_reporter()

  • Loading branch information...
TaiSakuma committed Feb 14, 2019
1 parent 894218a commit 48c0eafdfa66fcc61dcfdcb82e6da49d1cfd3a11
@@ -67,7 +67,7 @@ def open(self):
task_queue=self.task_queue,
result_queue=self.result_queue,
logging_queue=self.logging_queue,
progressReporter=self.progressMonitor.createReporter(),
progressReporter=self.progressMonitor.create_reporter(),
lock=self.lock
)
worker.start()
@@ -38,9 +38,9 @@ class BProgressMonitor(object):
Then, create as many reporters (`ProgressReporter`) as the
number of the tasks whose progresses need to be monitored::
reporter1 = monitor.createReporter()
reporter2 = monitor.createReporter()
reporter3 = monitor.createReporter()
reporter1 = monitor.create_reporter()
reporter2 = monitor.create_reporter()
reporter3 = monitor.create_reporter()
These reporters can be given to objects which execute the tasks.
These objects can be in other processes as long as the reporters
@@ -76,7 +76,7 @@ def __repr__(self):
def begin(self):
self.pickup = ProgressReportPickup(self.queue, self.presentation)
self.pickup.start()
reporter = self.createReporter()
reporter = self.create_reporter()
alphatwirl.progressbar._progress_reporter = reporter

def end(self):
@@ -15,11 +15,11 @@ alphatwirl.progressbar.BProgressMonitor

~BProgressMonitor.__init__
~BProgressMonitor.begin
~BProgressMonitor.createReporter
~BProgressMonitor.create_reporter
~BProgressMonitor.end







@@ -14,11 +14,11 @@ alphatwirl.progressbar.NullProgressMonitor
.. autosummary::

~NullProgressMonitor.begin
~NullProgressMonitor.createReporter
~NullProgressMonitor.create_reporter
~NullProgressMonitor.end







@@ -15,11 +15,11 @@ alphatwirl.progressbar.ProgressMonitor

~ProgressMonitor.__init__
~ProgressMonitor.begin
~ProgressMonitor.createReporter
~ProgressMonitor.create_reporter
~ProgressMonitor.end







@@ -65,7 +65,7 @@

reader_collector_pair = [alphatwirl.configure.build_counter_collector_pair(c) for c in tblcfg]
reader = alphatwirl.loop.ReaderComposite()
collector = alphatwirl.loop.CollectorComposite(alphaTwirl.progressMonitor.createReporter())
collector = alphatwirl.loop.CollectorComposite(alphaTwirl.progressMonitor.create_reporter())
for r, c in reader_collector_pair:
reader.add(r)
collector.add(c)
@@ -83,7 +83,7 @@ class MockProgressReporter(object):
@pytest.fixture()
def mock_progressmonitor():
ret = mock.MagicMock()
ret.createReporter.return_value = MockProgressReporter()
ret.create_reporter.return_value = MockProgressReporter()
return ret

@pytest.fixture()
@@ -20,7 +20,7 @@ class MockProgressReporter(object):
@pytest.fixture()
def mock_progressmonitor():
ret = mock.MagicMock()
ret.createReporter.return_value = MockProgressReporter()
ret.create_reporter.return_value = MockProgressReporter()
return ret

@pytest.fixture()
@@ -34,14 +34,14 @@ def test_begin_end(monitor, presentation):
monitor.end()
assert alphatwirl.progressbar._progress_reporter is None

def test_createReporter(monitor):
reporter = monitor.createReporter()
def test_create_reporter(monitor):
reporter = monitor.create_reporter()
assert isinstance(reporter, ProgressReporter)

def test_send_report(monitor, presentation):
presentation.active.return_value = True
monitor.begin()
reporter = monitor.createReporter()
reporter = monitor.create_reporter()
report = ProgressReport('task1', 0, 3)
reporter.report(report)
monitor.end()
@@ -69,8 +69,8 @@ def test_begin_end(monitor, MockReporter):
monitor.end()
assert progressbar._progress_reporter is None

def test_createReporter(monitor, mock_reporter, MockReporter, presentation):
reporter = monitor.createReporter()
def test_create_reporter(monitor, mock_reporter, MockReporter, presentation):
reporter = monitor.create_reporter()
assert [mock.call(queue = monitor.queue)] == MockReporter.call_args_list
assert reporter is mock_reporter

0 comments on commit 48c0eaf

Please sign in to comment.
You can’t perform that action at this time.