Draft
Conversation
….10 compatibility
…b Actions compatibility
There was a problem hiding this comment.
Pull Request Overview
This pull request adds support for aiohttp in the Multi-API Mocker utility along with several updates to testing fixtures, dependency definitions, and documentation. Key changes include:
- Removal of deprecated "setup_api_mocks" tests and renaming to "setup_http_mocks" with updated parameterizations.
- Addition of aiohttp-specific tests and fixtures, along with new dependency updates and documentation revisions.
- Updates to the plugin and utility modules to integrate and support aiohttp mocking.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/test_pytest/test_fixtures.py | Updated test functions to use setup_http_mocks, renaming and cleanup. |
| tests/test_pytest/test_aiohttp_fixtures.py | Added aiohttp tests for async API mocking. |
| tests/test_pytest/conftest.py | Switched import for aiohttp mocks with try/except block. |
| setup.py | Added aiohttp_requirements and updated extras for "all". |
| requirements_dev.txt | Updated dependencies including black and added aioresponses. |
| multi_api_mocker/http_utils.py | Minor formatting update with trailing comma in function signature. |
| multi_api_mocker/contrib/pytest_plugin.py | Integrated aiohttp fixtures and added a helper function for aiohttp. |
| multi_api_mocker/aiohttp_utils.py | New utility module for aiohttp support. |
| conftest.py | Added conditional pytest_plugins declaration for aioresponses. |
| README.md | Updated documentation to include aiohttp support and fixture usage. |
Comments suppressed due to low confidence (2)
tests/test_pytest/test_fixtures.py:28
- The renaming from test_commit_and_push_with_updated_http_mock to test_commit_and_push might lead to duplicate test names if an older version remains. Consider ensuring that all test function names are unique for clarity and easier debugging.
def test_commit_and_push(setup_http_mocks):
tests/test_pytest/test_fixtures.py:67
- [nitpick] The use of an ellipsis (...) in the test as a placeholder should be replaced with a 'pass' statement or a more explicit indicator that the test is pending implementation to improve code clarity.
@pytest.mark.parametrize(
conftest.py
Outdated
| from multi_api_mocker.contrib.pytest_plugin import aiohttp_available | ||
|
|
||
| if aiohttp_available: | ||
| pytest_plugins = "aioresponses" |
There was a problem hiding this comment.
[nitpick] It is more conventional to define pytest_plugins as a list of strings (e.g., ["aioresponses"]) to allow for future extensions and maintain clarity.
Suggested change
| pytest_plugins = "aioresponses" | |
| pytest_plugins = ["aioresponses"] |
Introduced MockAIOAPIResponse, a subclass of MockAPIResponse, to support advanced aioresponses features like custom headers, raw body content, and dynamic callbacks. This change enhances the library's capabilities for mocking aiohttp requests without altering the unified MockAPIResponse interface, ensuring backward compatibility. Key changes: - Created MockAIOAPIResponse in multi_api_mocker/aiohttp_utils.py to encapsulate advanced aiohttp mocking features. - Updated the pytest plugin in multi_api_mocker/contrib/pytest_plugin.py to recognize and utilize MockAIOAPIResponse. - Ensured that the new class is a drop-in replacement for MockAPIResponse and that existing tests pass without modification.
…ature/aiohttp-support # Conflicts: # multi_api_mocker/contrib/pytest_plugin.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.