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

Refactor tests to conftest, add stateful tests for remote services #551

Merged
merged 3 commits into from
Aug 5, 2023

Conversation

rikroe
Copy link
Member

@rikroe rikroe commented Aug 4, 2023

Proposed change

This PR tries to clean up tests.

We now use a conftest.py and pytest fixture for all our API calls (as in the Home Assistant tests).

While at it, the vehicle state inside a test function can now be updated (e.g. by remote service sideeffects), so we can check if remote service changes actually change the vehicle state.
While this is not so important in the lib, this is a major step that could be used in HA testing (change switch, execute remote service, check HA final state).
For this to work we probably have to move our tests inline, i.e. deploy them with the library (not in scope of this PR).

Also found and fixed an issue where pre-climatization could never be turned off using our remote service.

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (which adds functionality to this library)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:

Checklist

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works.

@rikroe rikroe requested a review from gerard33 August 4, 2023 18:19
@codecov
Copy link

codecov bot commented Aug 4, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (48d4c14) 100.00% compared to head (8df98f0) 100.00%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #551   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           18        18           
  Lines         1483      1504   +21     
=========================================
+ Hits          1483      1504   +21     
Flag Coverage Δ
3.10 100.00% <100.00%> (ø)
3.11 100.00% <100.00%> (ø)
3.7 100.00% <100.00%> (ø)
3.8 100.00% <100.00%> (ø)
3.9 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
bimmer_connected/vehicle/remote_services.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

gerard33
gerard33 previously approved these changes Aug 4, 2023
@rikroe
Copy link
Member Author

rikroe commented Aug 4, 2023

Was not expecting mypy to find these issues, as running from pre-commit doesn't fail.
Will check.

@rikroe rikroe merged commit e5d6e18 into bimmerconnected:master Aug 5, 2023
13 checks passed
@rikroe rikroe deleted the stateful-tests branch October 20, 2023 20:23
@github-actions github-actions bot locked and limited conversation to collaborators Oct 20, 2024
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