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

Allow setting custom defaults for async timeout and poll interval #256

Merged
merged 1 commit into from Mar 14, 2016

Conversation

mjbeauregard
Copy link
Contributor

Fixes: #255

In some cases (e.g. when running on slower machines) it can be useful to modify the default timeout and poll interval values like this:

// Swift

// Increase the global timeout to 5 seconds:
Nimble.Defaults.AsyncTimeout = 5

// Slow the polling interval to 0.1 seconds:
Nimble.Defaults.AsyncPollInterval = 0.1

@mjbeauregard
Copy link
Contributor Author

Note that we are still testing this PR in a real project and the results are mixed. For a few days we thought we had solved the problem, but are seeing timeout errors again today which is getting really frustrating. I will follow up again after more testing.

@jeffh
Copy link
Member

jeffh commented Feb 28, 2016

Have you tried looking at the CFRunLoop to see what timers you have attached at the point of failure?

The PR looks good to me, although I just merged in support for bleeding edge swift that moved files around and broke the mergability of the it.

I'll have some time after this week to try and resolve the merge conflicts if you don't get around to the PR.

@jeffh jeffh merged commit 816dca6 into Quick:master Mar 14, 2016
@pivotalstitch
Copy link

pivotalstitch commented Oct 4, 2016

Can someone please specify what a polling interval is? Also, how would one use this?

@mjbeauregard
Copy link
Contributor Author

Given the expression:

expect(someValue).toEventually(equal("blah"), timeout: 5.5, pollInterval: 0.2)

Nimble will repeatedly evaluate someValue every 0.2 seconds until it equals "blah" or until it times out (after 5.5 seconds, at which point the test will fail).

@modocache
Copy link
Member

modocache commented Oct 4, 2016

Thanks, @mjbeauregard! 👍

I'd happily merge pull requests to add docblocks to the public symbols in AsyncDefaults, as well as to expand the documentation on methods like toEventually. Strikes me as a potential point of confusion for users, who shouldn't be expected to know how async matchers poll their expectations.

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.

None yet

4 participants