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

Migrate tests to pytest #23544

Merged
merged 4 commits into from Apr 30, 2019

Conversation

Projects
None yet
3 participants
@emontnemery
Copy link
Contributor

commented Apr 29, 2019

Description:

Migrate some tests to pytest
Also some minor cleanup of tests

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
def setUp(self):
"""Set up the tests."""
self.hass = get_test_home_assistant()
self.hass.config.unit_system = METRIC_SYSTEM

This comment has been minimized.

Copy link
@emontnemery

emontnemery Apr 29, 2019

Author Contributor

Not needed?

This comment has been minimized.

Copy link
@balloob

balloob Apr 30, 2019

Member

Not anymore

"""Run when tests are started."""
self.hass = get_test_home_assistant()
run_coroutine_threadsafe(async_setup_component(
self.hass, 'homeassistant', {}), self.hass.loop).result()

This comment has been minimized.

Copy link
@emontnemery

emontnemery Apr 29, 2019

Author Contributor

Not needed?

This comment has been minimized.

Copy link
@balloob

balloob Apr 30, 2019

Member

Not anymore after we refactored scene. Used to be that this would set up homeassistant.turn_on

def test_as_local_with_local_object():
"""Test local with local object."""
now = dt_util.now()
assert now == now

This comment has been minimized.

Copy link
@emontnemery

emontnemery Apr 29, 2019

Author Contributor

Meaningless test, added here: e0ecb64
@balloob Any idea what this was intended to test?

try:
asyncio.get_event_loop()
except RuntimeError:
asyncio.set_event_loop(asyncio.new_event_loop())

This comment has been minimized.

Copy link
@emontnemery

emontnemery Apr 29, 2019

Author Contributor

Why is this needed?

This comment has been minimized.

Copy link
@emontnemery

emontnemery Apr 30, 2019

Author Contributor

Changed to use the loop fixture from aiohttp.pytest_plugin instead.

emontnemery added some commits Apr 30, 2019

@balloob
Copy link
Member

left a comment

Wow, very impressive, great work 🎉

@balloob

This comment has been minimized.

Copy link
Member

commented Apr 30, 2019

Looked at some of the CI results, and saw between 40s-1m30s speed bump!

@balloob balloob merged commit 407e0c5 into home-assistant:dev Apr 30, 2019

10 checks passed

ci/circleci: pre-install-all-requirements Your tests passed on CircleCI!
Details
ci/circleci: pre-test 3.5.5 Your tests passed on CircleCI!
Details
ci/circleci: pre-test 3.6 Your tests passed on CircleCI!
Details
ci/circleci: pre-test 3.7 Your tests passed on CircleCI!
Details
ci/circleci: pylint Your tests passed on CircleCI!
Details
ci/circleci: static-check Your tests passed on CircleCI!
Details
ci/circleci: test 3.5.5 Your tests passed on CircleCI!
Details
ci/circleci: test 3.6 Your tests passed on CircleCI!
Details
ci/circleci: test 3.7 Your tests passed on CircleCI!
Details
cla-bot Everyone involved has signed the CLA

@balloob balloob referenced this pull request May 14, 2019

Merged

0.93.0 #23864

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.