Skip to content

Make start timeout work properly.#216

Open
artikz wants to merge 1 commit intoxiaocong:masterfrom
artikz:fix-start-timeout
Open

Make start timeout work properly.#216
artikz wants to merge 1 commit intoxiaocong:masterfrom
artikz:fix-start-timeout

Conversation

@artikz
Copy link

@artikz artikz commented May 21, 2017

self.alive is an RPC call, which can take a long time (e.g. 45s) if there are problems with communicating to server.
Previously the loop was being executed exactly timeout * 10 times before timing out, resulting in 450s timeout instead of the requested value.
Now it is executed only until current timestamp is larger or equal the pre-calculated expiration time.

self.alive is an RPC call, which can take a long time (e.g. 45s) if there are problems with communicating to server.
Previously the loop was being executed exactly timeout * 10 times befor timing out, resulting in 450s timeout instead of the requested value.
Now it is executed only until current timestamp is larger or equal the pre-calculated expiration time.
Copy link

@mcdaniel67 mcdaniel67 left a comment

Choose a reason for hiding this comment

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

Passing travis run rebased on top of my travis fix pr:
https://travis-ci.org/mcdaniel67/uiautomator/builds/234657095

time.sleep(0.1)
timeout -= 0.1
if not self.alive:
step_secs = 0.1

Choose a reason for hiding this comment

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

What are your thoughts about making this a defaulted argument?

A doc string would be good on this method too.


# Tests that start() timeout works correctly even in case communication
# with device takes too long.
def test_start_timeout_works_properly(self):

Choose a reason for hiding this comment

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

This test could be named better, particularly the "_works_properly" part. Maybe call it test_start_timeout_slow_device?

Also, any reason to go with comments over a docstring?

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