Skip to content

Commit

Permalink
Make ndb.eventloop private. (#6392)
Browse files Browse the repository at this point in the history
Make eventloop private.

Makes ndb.eventloop private by renaming to ndb._eventloop. Addresses #6376 .
  • Loading branch information
Chris Rossi authored Nov 5, 2018
1 parent 5396808 commit a6d0f10
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions ndb/MIGRATION_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ The primary differences come from:
Now `Property._FIND_METHODS_CACHE` is set to `{}` when the `Property` class
is created and there is another level of keys (based on fully-qualified
class name) in the cache.
- `eventloop` has been renamed to `_eventloop`. It is believed that `eventloop`
was previously a *de facto* private module, so we've just made that
explicit.

## Comments

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import pytest

from google.cloud.ndb import eventloop
from google.cloud.ndb import _eventloop as eventloop
import tests.unit.utils


Expand Down Expand Up @@ -125,15 +125,15 @@ def test_queue_call_now(self):
assert list(loop.current) == [("foo", ("bar",), {"baz": "qux"})]
assert not loop.queue

@unittest.mock.patch("google.cloud.ndb.eventloop.time")
@unittest.mock.patch("google.cloud.ndb._eventloop.time")
def test_queue_call_soon(self, time):
loop = self._make_one()
time.time.return_value = 5
loop.queue_call(5, "foo", "bar", baz="qux")
assert not loop.current
assert loop.queue == [_Event(10, "foo", ("bar",), {"baz": "qux"})]

@unittest.mock.patch("google.cloud.ndb.eventloop.time")
@unittest.mock.patch("google.cloud.ndb._eventloop.time")
def test_queue_call_absolute(self, time):
loop = self._make_one()
time.time.return_value = 5
Expand Down Expand Up @@ -217,7 +217,7 @@ def test_run0_idler(self):
assert loop.run0() == 0
callback.assert_called_once_with("foo", bar="baz")

@unittest.mock.patch("google.cloud.ndb.eventloop.time")
@unittest.mock.patch("google.cloud.ndb._eventloop.time")
def test_run0_next_later(self, time):
time.time.return_value = 0
callback = unittest.mock.Mock(__name__="callback")
Expand All @@ -229,7 +229,7 @@ def test_run0_next_later(self, time):
assert len(loop.queue) == 1
assert loop.inactive == 88

@unittest.mock.patch("google.cloud.ndb.eventloop.time")
@unittest.mock.patch("google.cloud.ndb._eventloop.time")
def test_run0_next_now(self, time):
time.time.return_value = 0
callback = unittest.mock.Mock(__name__="callback")
Expand All @@ -253,7 +253,7 @@ def test_run1_nothing_to_do(self):
loop = self._make_one()
assert loop.run1() is False

@unittest.mock.patch("google.cloud.ndb.eventloop.time")
@unittest.mock.patch("google.cloud.ndb._eventloop.time")
def test_run1_has_work_now(self, time):
callback = unittest.mock.Mock(__name__="callback")
loop = self._make_one()
Expand All @@ -262,7 +262,7 @@ def test_run1_has_work_now(self, time):
time.sleep.assert_not_called()
callback.assert_called_once_with()

@unittest.mock.patch("google.cloud.ndb.eventloop.time")
@unittest.mock.patch("google.cloud.ndb._eventloop.time")
def test_run1_has_work_later(self, time):
time.time.return_value = 0
callback = unittest.mock.Mock(__name__="callback")
Expand All @@ -272,7 +272,7 @@ def test_run1_has_work_later(self, time):
time.sleep.assert_called_once_with(5)
callback.assert_not_called()

@unittest.mock.patch("google.cloud.ndb.eventloop.time")
@unittest.mock.patch("google.cloud.ndb._eventloop.time")
def test_run(self, time):
time.time.return_value = 0

Expand Down

0 comments on commit a6d0f10

Please sign in to comment.