Skip to content

Test delay can be zero in ConstantSpeculativeExecutionPolicy#853

Merged
beltran merged 1 commit into
masterfrom
python-836
Nov 16, 2017
Merged

Test delay can be zero in ConstantSpeculativeExecutionPolicy#853
beltran merged 1 commit into
masterfrom
python-836

Conversation

@beltran

@beltran beltran commented Nov 8, 2017

Copy link
Copy Markdown
Contributor

No description provided.

@mambocab

Copy link
Copy Markdown
Contributor

+1, I've included a suggestion for simplifying it a bit, but looks good 👍

session = cluster.connect(wait_for_all_pools=True)
self.addCleanup(cluster.shutdown)

ResponseFuture._on_speculative_execute = count_and_patch(ResponseFuture._on_speculative_execute, counter)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you can do this with

ResponseFuture._on_speculative_execute = mock.patch(
    wraps=ResponseFuture._on_speculative_execute
)

...

self.assertEqual(ResponseFuture._on_speculative_execute.call_count,
                 number_of_requests)

@beltran

beltran commented Nov 16, 2017

Copy link
Copy Markdown
Contributor Author

Thank you for the suggestion, I've done it that way but with a slightly different syntax.

@beltran beltran merged commit 52834b3 into master Nov 16, 2017
@beltran beltran deleted the python-836 branch November 16, 2017 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants