-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
Migrate tests to pytest #23544
Conversation
def setUp(self): | ||
"""Set up the tests.""" | ||
self.hass = get_test_home_assistant() | ||
self.hass.config.unit_system = METRIC_SYSTEM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests/scripts/test_check_config.py
Outdated
try: | ||
asyncio.get_event_loop() | ||
except RuntimeError: | ||
asyncio.set_event_loop(asyncio.new_event_loop()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to use the loop
fixture from aiohttp.pytest_plugin
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, very impressive, great work 🎉
Looked at some of the CI results, and saw between 40s-1m30s speed bump! |
Description:
Migrate some tests to pytest
Also some minor cleanup of tests
Checklist:
tox
. Your PR cannot be merged unless tests pass