8000 Update unit tests for remote.py by kellerza · Pull Request #2782 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Update unit tests for remote.py #2782

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

Merged
merged 2 commits into from
Aug 11, 2016
Merged

Update unit tests for remote.py #2782

merged 2 commits into from
Aug 11, 2016

Conversation

kellerza
Copy link
Member

Description:
test_remote seems to be one of the culprits for tox sometimes failing

Checklist:

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.


bootstrap.setup_component(hass, 'api')

hass.start()
time.sleep(0.05)
def block_start(hass_obj):
Copy link
Member

Choose a reason for hiding this comment

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

You are replicating exactly what hass_obj.start() does: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/core.py#L127-L128

Sleeping 0.05 seconds allows Python switch to the WSGI server thread and boot up the sockets.

Read more about the GIL and how and why it works

Copy link
Member Author

Choose a reason for hiding this comment

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

Interesting, maybe releasing the GIL with such a sleep() fix some of my busy threads issues:

WorkerPool:All 12 threads are busy and 73 jobs pending

It always seems to happen around start & adding an array of many devices add_devices (and their state updates)

@balloob balloob merged commit bf21d6b into home-assistant:dev Aug 11, 2016
@balloob
Copy link
Member
balloob commented Aug 11, 2016

Awesome 🐬

@kellerza kellerza deleted the tests branch September 3, 2016 20:03
@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0