Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: refactor concurrency test using orchestrate #709

Merged
merged 8 commits into from
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion google/cloud/ndb/_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ def _update_key(key, new_value):
utils.logging_debug(log, "old value: {}", old_value)

value = new_value(old_value)
utils.logging_debug(log, "new value: {}", value)
utils.logging_debug(log, "new value: {}", value) # pragma: SYNCPOINT update key

if old_value is not None:
utils.logging_debug(log, "compare and swap")
Expand Down
35 changes: 22 additions & 13 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,31 @@ def initialize_environment(request, environ):


@pytest.fixture
def context():
client = mock.Mock(
project="testing",
namespace=None,
spec=("project", "namespace"),
stub=mock.Mock(spec=()),
)
context = context_module.Context(
client,
eventloop=TestingEventLoop(),
datastore_policy=True,
legacy_data=False,
)
def context_factory():
def context(**kwargs):
client = mock.Mock(
project="testing",
namespace=None,
spec=("project", "namespace"),
stub=mock.Mock(spec=()),
)
context = context_module.Context(
client,
eventloop=TestingEventLoop(),
datastore_policy=True,
legacy_data=False,
**kwargs
)
return context

return context


@pytest.fixture
def context(context_factory):
return context_factory()


@pytest.fixture
def in_context(context):
assert not context_module._state.context
Expand Down
Loading