Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #317 +/- ##
==========================================
+ Coverage 99.04% 99.06% +0.01%
==========================================
Files 22 22
Lines 1051 1073 +22
==========================================
+ Hits 1041 1063 +22
Misses 10 10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This pull request adds type hints and docstrings throughout the Mocket codebase in response to issue #203, which requested improved code readability and static type checking support. The changes primarily consist of:
- Adding comprehensive docstrings following Google/NumPy style to all public methods and classes
- Adding type hints to function signatures and class attributes
- Reorganizing imports in test files to follow PEP 8 conventions (stdlib → third-party → mocket submodules → mocket main package)
Changes:
- Added module-level docstrings to all mocket source files
- Added comprehensive function and method docstrings with Args, Returns, and Raises sections
- Added type hints using modern Python syntax (PEP 604 union types, etc.)
- Reorganized imports in test files for consistency
- Removed minor whitespace inconsistencies
- Removed pragma: no cover comment from send method after adding proper documentation
- Added explicit return type annotation for MocketSocketIO.write()
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_utils.py | Removed extra blank line in imports |
| tests/test_socket.py | Reorganized imports (mocket.socket before mocket main) |
| tests/test_redis.py | Reorganized imports (mocket.mockredis before mocket main) |
| tests/test_pook.py | Removed extra blank line in imports |
| tests/test_mode.py | Reorganized imports (mocket submodules before mocket main) |
| tests/test_mocket.py | Reorganized imports (mocket.compat before mocket main) |
| tests/test_httpx.py | Reorganized imports (mocket submodules before mocket main) |
| tests/test_https.py | Reorganized imports (mocket.mockhttp before mocket main) |
| tests/test_httpretty.py | Reorganized imports (mocket.plugins before sure) |
| tests/test_http_httpx.py | Removed extra blank line in imports |
| tests/test_http.py | Reorganized imports (mocket.mocks.mockhttp before mocket main) |
| tests/test_asyncio.py | Reorganized imports (mocket submodules before mocket main) |
| mocket/utils.py | Added module docstring, improved docstrings for hexdump/hexload/get_mocketize |
| mocket/urllib3.py | Added module docstring and function docstrings |
| mocket/types.py | Added module docstring |
| mocket/ssl/socket.py | Added class/method docstrings and type hints for MocketSSLSocket |
| mocket/ssl/context.py | Added class/method docstrings and type hints for SSL context classes |
| mocket/socket.py | Added comprehensive docstrings and type hints for MocketSocket, removed FIXME comment |
| mocket/recording.py | Added module docstring, class/method docstrings and type hints |
| mocket/mode.py | Added module docstring and method docstrings for _MocketMode |
| mocket/mocks/mockredis.py | Added module/class/method docstrings and type hints |
| mocket/mocks/mockhttp.py | Added module/class/method docstrings and type hints |
| mocket/mocket.py | Added module docstring and method docstrings for Mocket singleton |
| mocket/io.py | Added module/class/method docstrings, added return statement to write() |
| mocket/inject.py | Added module docstring and function docstrings |
| mocket/exceptions.py | Added module docstring and exception class docstrings |
| mocket/entry.py | Added module/class/method docstrings and type hints |
| mocket/decorators/mocketizer.py | Added module/class/method docstrings and type hints |
| mocket/decorators/async_mocket.py | Added module docstring and function docstrings |
| mocket/compat.py | Added function docstrings with Args/Returns sections |
| mocket/init.py | Added module docstring |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot Please revert the lines where we got rid of doctests. |
|
@mindflayer I've opened a new pull request, #318, to work on those changes. Once the pull request is ready, I'll request review from you. |
* Initial plan * Restore doctests in mockhttp.py for set_extra_headers, can_handle, and _parse_requestline Co-authored-by: mindflayer <527325+mindflayer@users.noreply.github.com> * Add coverage.xml to .gitignore and remove from tracking Co-authored-by: mindflayer <527325+mindflayer@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mindflayer <527325+mindflayer@users.noreply.github.com>
|
@mindflayer I've opened a new pull request, #319, to work on those changes. Once the pull request is ready, I'll request review from you. |
* Initial plan * Fix setsockopt signature to match standard socket API Co-authored-by: mindflayer <527325+mindflayer@users.noreply.github.com> * Add tests for setsockopt with and without optlen Co-authored-by: mindflayer <527325+mindflayer@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mindflayer <527325+mindflayer@users.noreply.github.com>
|



Completing what was requested in #203.