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

Convert common fixtures to plain functions #221

Merged
merged 35 commits into from
Oct 3, 2024

Conversation

puddly
Copy link
Contributor

@puddly puddly commented Oct 2, 2024

The dependency chains created by pytest fixtures unfortunately make selectively applying fixtures (or figuring out how they work at times) difficult. I've converted the following fixtures to normal functions that usually operate on a single Gateway object:

  • zha_device_from_file -> zigpy_device_from_device_data and zigpy_device_from_json
  • device_joined -> join_zigpy_device
  • zigpy_device_mock -> create_mock_zigpy_device

Going forward, I think mock devices created within fixtures should ideally be replaced with real device mocks created from JSON dumps.

Copy link

codecov bot commented Oct 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.40%. Comparing base (693a881) to head (dcca820).
Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #221   +/-   ##
=======================================
  Coverage   96.40%   96.40%           
=======================================
  Files          61       61           
  Lines        9359     9359           
=======================================
  Hits         9023     9023           
  Misses        336      336           

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

@puddly puddly marked this pull request as draft October 2, 2024 20:53
@puddly puddly changed the title Convert zha_device_from_file and device_joined fixtures to functions Convert common fixtures to plain functions Oct 3, 2024
@puddly puddly marked this pull request as ready for review October 3, 2024 14:51
tests/conftest.py Outdated Show resolved Hide resolved
@puddly puddly merged commit cda1b95 into zigpy:dev Oct 3, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants