-
Notifications
You must be signed in to change notification settings - Fork 63
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
feat: add pytest and coverage #68
Conversation
remove sentry_mode_available flag to use the property from vehicle
add a mock for Tesla server communications
Thanks this is awesome. No negative judgment from me as the test suite closes something I haven't done for years now despite the issue #26 mainly cause I also am just learning. There are a few warnings though. Have you taken a look to try to reduce them? Not saying it has to be done if you're not sure how--particularly given how much better it is with this, but would be nice to have those resolved. ========================================================= warnings summary ==========================================================
/Users/alandtse/.local/share/virtualenvs/teslajsonpy-JT0bMHGZ/lib/python3.7/site-packages/pytest_asyncio/plugin.py:39: 47 tests with warnings
/Users/alandtse/.local/share/virtualenvs/teslajsonpy-JT0bMHGZ/lib/python3.7/site-packages/pytest_asyncio/plugin.py:39: PytestDeprecationWarning: direct construction of Function has been deprecated, please use Function.from_parent
item = pytest.Function(name, parent=collector)
/Users/alandtse/.local/share/virtualenvs/teslajsonpy-JT0bMHGZ/lib/python3.7/site-packages/pytest_asyncio/plugin.py:45: 47 tests with warnings
/Users/alandtse/.local/share/virtualenvs/teslajsonpy-JT0bMHGZ/lib/python3.7/site-packages/pytest_asyncio/plugin.py:45: PytestDeprecationWarning: direct construction of Function has been deprecated, please use Function.from_parent
item = pytest.Function(name, parent=collector) # To reload keywords.
-- Docs: https://docs.pytest.org/en/latest/warnings.html
================================================== 77 passed, 94 warnings in 0.54s ================================================== |
All the warnings are linked to pytest-asyncio. See pytest-dev/pytest-asyncio#141. Downgrading to pytest<5.4.1 (5.3.5) removes all warnings 👍 |
It's an upcoming deprecation warning. I don't think pinning to an older version to avoid the warning is necessarily the way to solve it. ;) Let me know when you think you've finished your pushes. |
Right! I am not downgrading pytest, just confirming that the warnings are not linked to teslajsonpy. |
Coverage is 69% total, 100% for device and sensors. If you are satisfied with the current status, please merge. We can see how to provide unit tests for Connection and Controller later. |
Thanks for all your help. Merging it shortly. Mocking those are probably just mocking the return values from the Tesla servers based off data we've seen before. |
Enable pytest and coverage framework to address issue #26.
Add a mock to simulate Tesla servers in unit tests.
Add tests for sentry mode, GPS, odometer, battery, range, charger connection, online, parking.
Fix initialization of sentry_mode_available in VehicleDevice and sentry_mode in SentryModeSwitch.