Package: python-duckpy Version: 3.2.0-3 Severity: normal Dear Maintainer,
I'd like to submit a patch for the python-duckpy package that fixes failing tests "test_duckpy_basic.py::test_functional" and "test_duckpy_basic.py::test_asyncio_results" See the failure in https://ci.debian.net/packages/p/python-duckpy/unstable/amd64/59991878/ Before the fix: ============================================================ test session starts ============================================================= platform linux -- Python 3.13.3, pytest-8.3.5, pluggy-1.5.0 -- /usr/bin/python3 cachedir: .pytest_cache rootdir: /home/python-duckpy/python-duckpy-test/python-duckpy-3.2.0 plugins: cov-5.0.0, anyio-4.8.0, asyncio-0.25.1, tornasync-0.6.0.post2, flaky-3.8.1, typeguard-4.4.2, httpbin-2.1.0, xdist-3.6.1 asyncio: mode=Mode.STRICT, asyncio_default_fixture_loop_scope=None collected 2 items debian/tests/test_duckpy_basic.py::test_functional FAILED debian/tests/test_duckpy_basic.py::test_asyncio_results FAILED ================================================================== FAILURES ================================================================== ______________________________________________________________ test_functional _______________________________________________________________ def test_functional(): client = Client() > results = client.search("Python Wikipedia") debian/tests/test_duckpy_basic.py:7: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <duckpy.Client object at 0x7fa6c9237a10>, query = 'Python Wikipedia', exact_match = False, kwargs = {}, proxy = None, ua = None headers = None def search(self, query: str, exact_match: bool = False, **kwargs) -> List[ResultDict]: if exact_match: query = '"%s"' % query if isinstance(self.proxies, str): proxy = self.proxies elif isinstance(self.proxies, list): proxy = random.choice(self.proxies) if self.proxies else None else: proxy = None if isinstance(self.default_user_agents, str): ua = self.default_user_agents elif isinstance(self.default_user_agents, list): ua = random.choice(self.default_user_agents) if self.default_user_agents else None else: ua = None headers = {'User-Agent': ua} if ua else None > with httpx.Client(proxies=proxy, http2=True) as http: E TypeError: Client.__init__() got an unexpected keyword argument 'proxies' duckpy/__init__.py:42: TypeError ____________________________________________________________ test_asyncio_results ____________________________________________________________ def test_asyncio_results(): loop = asyncio.get_event_loop() > loop.run_until_complete(get_asyncio_results()) debian/tests/test_duckpy_basic.py:34: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.13/asyncio/base_events.py:719: in run_until_complete return future.result() debian/tests/test_duckpy_basic.py:20: in get_asyncio_results results = await client.search("Debian") _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <duckpy.AsyncClient object at 0x7fa6c8b2e3c0>, query = 'Debian', exact_match = False, kwargs = {}, proxy = None, ua = None headers = None async def search(self, query: str, exact_match: bool = False, **kwargs) -> List[ResultDict]: if exact_match: query = '"%s"' % query if isinstance(self.proxies, str): proxy = self.proxies elif isinstance(self.proxies, list): proxy = random.choice(self.proxies) if self.proxies else None else: proxy = None if isinstance(self.default_user_agents, str): ua = self.default_user_agents elif isinstance(self.default_user_agents, list): ua = random.choice(self.default_user_agents) if self.default_user_agents else None else: ua = None headers = {'User-Agent': ua} if ua else None > async with httpx.AsyncClient(proxies=proxy, http2=True) as http: E TypeError: AsyncClient.__init__() got an unexpected keyword argument 'proxies' duckpy/__init__.py:72: TypeError After applying the attached patch: python3 -m pytest -v -s debian/tests/test_duckpy_basic.py /usr/lib/python3/dist-packages/pytest_asyncio/plugin.py:207: PytestDeprecationWarning: The configuration option "asyncio_default_fixture_loop_scope" is unset. The event loop scope for asynchronous fixtures will default to the fixture caching scope. Future versions of pytest-asyncio will default the loop scope for asynchronous fixtures to function scope. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: "function", "class", "module", "package", "session" warnings.warn(PytestDeprecationWarning(_DEFAULT_FIXTURE_LOOP_SCOPE_UNSET)) ============================================================ test session starts ============================================================= platform linux -- Python 3.13.3, pytest-8.3.5, pluggy-1.5.0 -- /usr/bin/python3 cachedir: .pytest_cache rootdir: /home/python-duckpy/python-duckpy-test/python-duckpy-3.2.0 plugins: cov-5.0.0, anyio-4.8.0, asyncio-0.25.1, tornasync-0.6.0.post2, flaky-3.8.1, typeguard-4.4.2, httpbin-2.1.0, xdist-3.6.1 asyncio: mode=Mode.STRICT, asyncio_default_fixture_loop_scope=None collected 2 items debian/tests/test_duckpy_basic.py::test_functional PASSED debian/tests/test_duckpy_basic.py::test_asyncio_results PASSED Thank you for considering this patch attached Rong Fu
httpx-proxy-api-update.patch
Description: httpx-proxy-api-update.patch