Skip to content

Feature/aiohttp support#7

Draft
jab3z wants to merge 18 commits intomainfrom
feature/aiohttp-support
Draft

Feature/aiohttp support#7
jab3z wants to merge 18 commits intomainfrom
feature/aiohttp-support

Conversation

@jab3z
Copy link
Collaborator

@jab3z jab3z commented Jun 26, 2025

No description provided.

@jab3z jab3z requested a review from Copilot June 26, 2025 21:05

This comment was marked as outdated.

@jab3z jab3z requested a review from Copilot June 27, 2025 08:07
@jab3z jab3z marked this pull request as draft June 27, 2025 08:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
Copy link

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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"]

Copilot uses AI. Check for mistakes.
jab3z added 3 commits June 27, 2025 12:36
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
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.

1 participant