Python 3.13.2 Migration - Test Mocking Compatibility Issues with Requests and Mock Library
I'm experiencing some challenges while migrating a project from Python 2.7 to Python 3.13.2, specifically with test mocking for HTTP requests. Context: Migrating an existing project from Python 2.7 to Python 3.13.2 Using pytest for testing Custom test mocking utility for HTTP requests Specific Issue: When running tests, I'm encountering the following error across multiple test cases: TypeError: FakeRest.perform_request() got an unexpected keyword argument 'verify' Detailed Observations: In Python 2.7 (nosetests), all 27 tests passed successfully In Python 3.13.2 (pytest), 7 out of 27 tests are failing The primary error is related to an unexpected 'verify' keyword argument Questions: How can I modify my custom mock class to handle the 'verify' parameter in Python 3.13.2? Are there known differences in request mocking between Python 2.7 and Python 3.x? What are the best practices for updating test mocking utilities during Python version migration? Relevant Code Snippet (Simplified): class FakeRest: def perform_request(self, method, *args, **kwargs): # Current implementation doesn't handle 'verify' parameter # Throws TypeError in Python 3.13.2 Desired Outcome: Make the test mocking compatible with Python 3.13.2 Maintain the existing test logic Ensure all tests pass Environment: Python 3.13.2 pytest 8.3.5 Custom test utilities Requests library Any guidance on handling this migration challenge would be greatly appreciated! https://community.nextwork.org/c/i-have-a-question/python-3-13-2-migration-test-mocking-compatibility-issues-with-requests-and-mock-library

I'm experiencing some challenges while migrating a project from Python 2.7 to Python 3.13.2, specifically with test mocking for HTTP requests.
Context:
Migrating an existing project from Python 2.7 to Python 3.13.2
Using pytest for testing
Custom test mocking utility for HTTP requests
Specific Issue: When running tests, I'm encountering the following error across multiple test cases:
TypeError: FakeRest.perform_request() got an unexpected keyword argument 'verify'
Detailed Observations:
In Python 2.7 (nosetests), all 27 tests passed successfully
In Python 3.13.2 (pytest), 7 out of 27 tests are failing
The primary error is related to an unexpected 'verify' keyword argument
Questions:
How can I modify my custom mock class to handle the 'verify' parameter in Python 3.13.2?
Are there known differences in request mocking between Python 2.7 and Python 3.x?
What are the best practices for updating test mocking utilities during Python version migration?
Relevant Code Snippet (Simplified):
class FakeRest:
def perform_request(self, method, *args, **kwargs):
# Current implementation doesn't handle 'verify' parameter
# Throws TypeError in Python 3.13.2
Desired Outcome:
Make the test mocking compatible with Python 3.13.2
Maintain the existing test logic
Ensure all tests pass
Environment:
Python 3.13.2
pytest 8.3.5
Custom test utilities
Requests library
Any guidance on handling this migration challenge would be greatly appreciated!