1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00
Commit Graph

527 Commits

Author SHA1 Message Date
Martin Brunthaler
ac230b76af Call urllib.parse less frequently 2025-01-04 15:42:49 -03:00
kevin1024
3278619dcc Release v7.0.0 2024-12-30 18:59:50 -05:00
Aleksei Kozharin
3fb62e0f9b fix: correctly handle asyncio.run when loop exists 2024-12-30 13:34:03 -03:00
Igor Gumenyuk
48d0a2e453 Fixed missing version_string attribute when used with urllib3>=2.3.0
urllib3 in v2.3.0 introduced attribute `version_string` (https://github.com/urllib3/urllib3/pull/3316/files). This attribute  is missing in `VCRHTTPResponse` which causes errors like AttributeError: 'VCRHTTPResponse' object has no attribute 'version_string'

This fixes https://github.com/kevin1024/vcrpy/issues/888
2024-12-28 13:39:53 -03:00
Jair Henrique
5b858b132d Fix lint 2024-12-28 13:25:04 -03:00
Jair Henrique
ab8944d3ca Drop python 3.8 support 2024-10-12 22:44:42 -03:00
Kevin McCarthy
1d100dda25 release v6.0.2 2024-10-07 08:55:44 -04:00
Mathieu Parent
241b0bbd91 Ensure body is consumed only once
Fixes: #846
Signed-off-by: Mathieu Parent <math.parent@gmail.com>
2024-07-21 22:53:45 +02:00
pre-commit
c88f2c0dab pre-commit: Mass-apply ruff formatter 2024-03-06 14:35:01 +01:00
Kevin McCarthy
68038d0559 release v6.0.1 2024-01-25 11:13:56 -05:00
Thomas Grainger
f76289aa78 Merge pull request #811 from kevin1024/graingert-patch-1
return values from generator decorator
2024-01-24 13:22:32 +00:00
Kevin McCarthy
1e3a5ac753 Release v6.0.0 2024-01-23 10:54:46 -05:00
Thomas Grainger
b1c45cd249 return values from generator decorator 2024-01-23 15:07:23 +00:00
Thomas Grainger
6d7a842a33 fix test_tornado_exception_can_be_caught RuntimeError: generator raised StopIteration 2024-01-23 12:24:48 +00:00
Thomas Grainger
5104b1f462 Merge branch 'master' of github.com:kevin1024/vcrpy into fix-resource-warning-2 2024-01-23 11:03:49 +00:00
Allan Crooks
54bc6467eb Run linters. 2024-01-22 23:13:10 -03:00
Allan Crooks
c5487384ee Fix handling of encoded content in HTTPX stub.
Also copied over and adjusted some of the tests from
test_requests.py relating to gzipped handling to show
that the HTTPX stub is behaving in a consistent way to
how the requests stub is.
2024-01-22 23:13:10 -03:00
Allan Crooks
5cf23298ac HTTPX stub now generates cassettes in the same format as other stubs.
As part of this, I've removed the tests which inspect the
data type of the response content in the cassette. That
behaviour should be controlled via the inbuilt serializers.
2024-01-22 23:13:10 -03:00
Allan Crooks
5fa7010712 Allow HTTPX stub to read cassettes generated by other stubs.
This was due to a custom format being defined in the HTTPX stub.
2024-01-22 23:13:10 -03:00
Thomas Grainger
cc4d03c62e close unremoved connections (pool already removed the connection) 2023-12-15 19:11:25 +00:00
Thomas Grainger
d39c26b358 remember to close removed connections 2023-12-15 14:26:44 +00:00
Thomas Grainger
d76c243513 Revert "Fix ResourceWarning unclosed socket"
This reverts commit f4144359f6.
2023-12-15 14:01:14 +00:00
Thomas Grainger
5cff354ec8 Revert "fix a KeyError"
This reverts commit fa789e975b.
2023-12-15 14:01:10 +00:00
Thomas Grainger
fa789e975b fix a KeyError 2023-12-15 11:07:56 +00:00
Thomas Grainger
17c78bff9e Merge branch 'master' of github.com:kevin1024/vcrpy into fix-resource-warning-2 2023-12-15 10:48:27 +00:00
Jair Henrique
88cf01aa14 Fix format code 2023-12-12 14:24:22 -03:00
Parker Hancock
85ae012d9c fix linting 2023-12-12 14:24:22 -03:00
Parker Hancock
db1e9e7180 make cassettes human readable 2023-12-12 14:24:22 -03:00
Jair Henrique
cebdd45849 Use ruff to check code format intead of black 2023-12-10 20:12:09 -03:00
Parker Hancock
5532c0b4cf more attempts to make the linters happy 2023-12-08 16:38:33 -03:00
Parker Hancock
f4467a8d6c make linters happy 2023-12-08 16:38:33 -03:00
Parker Hancock
e8e9a4af9f remove unnecssary comment 2023-12-08 16:38:33 -03:00
Parker Hancock
7bf8f65815 fixes for httpx 2023-12-08 16:38:33 -03:00
Michał Górny
69621c67fb Copy debuglevel and _http_vsn attrs into response classes
Copy the `debuglevel` and `_http_vsn` attributes from base connection
class into response classes, in order to fix compatibility with
Python 3.12.  For reasons I don't comprehend, these end up being called
on the class rather than instance, so regular proxying logic does not
work.

Fixes #707
2023-08-09 10:09:12 -03:00
Mohammad Razavi
f4144359f6 Fix ResourceWarning unclosed socket
This PR fixes issue #710 by properly closing the underlying socket. It
first uses `pool._put_conn` to keep the connection in the pool, and
later removes and closes it when the context manager exits.

I was unsure about the exact purpose of the `ConnectonRemove` class,
so I made minimal changes to minimize the risk of breaking the code
and there may be better solutions for fixing this issue.

For example, the `urllib3.connectionpool.HTTPConnectionPool` will
utilize a weakref to terminate pool connections. By appending our
connection to it, it will also take care of closing our connection. So
another solution could be to modify the `__exit__` in
`patch.ConnectionRemover` method and add our connection to the pool:

```py
class ConnectionRemover:
    ...

    def __exit__(self, *args):
        for pool, connections in self._connection_pool_to_connections.items():
            for connection in connections:
                if isinstance(connection, self._connection_class):
                    pool._put_conn(connection)
```
2023-08-07 08:42:58 +02:00
Jair Henrique
69de388649 Drop simplejson support 2023-08-01 08:53:31 -03:00
Jair Henrique
6446d00e27 Drop boto 2 support 2023-07-31 08:49:23 -03:00
Kevin McCarthy
d6bded1820 bump version to v5.1.0 2023-07-30 17:11:15 -10:00
Sebastian Pipping
e7c00a4bf9 Merge pull request #739 from kevin1024/issue-734-fix-body-matcher-for-chunked-requests
Fix body matcher for chunked requests (fixes #734)
2023-07-23 23:22:34 +02:00
Jair Henrique
cdab3fcb30 Drop iscoroutinefunction fallback function for unsupported python 2023-07-23 12:30:58 -03:00
Sebastian Pipping
a045a46bb4 Merge pull request #740 from kevin1024/issue-512-fix-query-param-filter-for-aiohttp
Fix query param filter for aiohttp (fixes #517)
2023-07-19 15:37:54 +02:00
Simon Charette
f7d76bd40a Remove unnecessary dependency on six.
Remove the last remaining usag of it in VCR.testcase.
2023-07-16 22:22:34 -04:00
Sebastian Pipping
8336d66976 aiohttp_stubs.py: Stop leaking unfiltered URL into cassette responses 2023-07-10 16:11:26 +02:00
Sebastian Pipping
a6b9a070a5 matchers.py: Decode chunked request bodies 2023-07-08 02:25:51 +02:00
Sebastian Pipping
e35205c5c8 matchers.py: Support transforming the request body multiple times 2023-07-08 01:29:19 +02:00
Sebastian Pipping
05f61ea56c Make json.loads of Python >=3.6 decode bytes by itself
Quoting https://docs.python.org/3/library/json.html#json.loads :
> Changed in version 3.6: s can now be of type bytes or bytearray.
> The input encoding should be UTF-8, UTF-16 or UTF-32.
2023-07-07 20:00:57 +02:00
Jair Henrique
4f70152e7c Enable rule B (flake8-bugbear) on ruff 2023-06-27 17:36:26 -03:00
Jair Henrique
016a394f2c Enable E, W and F linters for ruff 2023-06-26 20:46:09 -03:00
Jair Henrique
6b2fc182c3 Improve string format 2023-06-26 20:46:09 -03:00
Jair Henrique
a77173c002 Use ruff as linter 2023-06-26 20:46:09 -03:00