From 2907848185adcb4e6d8c093db6c617c64cb8c8bf Mon Sep 17 00:00:00 2001 From: Georg Sauthoff Date: Sat, 5 Feb 2022 14:42:10 +0100 Subject: [PATCH] Use current pytest_httpx add_response keyword The new text keyword was introduced in pytest_httpx 0.14, deprecated in 0.14 and 0.17 and removed in 0.18. Thus, an appropriate constraint to that dependency is added. FWIW, this fixes the test cases on the upcoming Fedora 36 release. See also: - https://github.com/Colin-b/pytest_httpx/blob/develop/CHANGELOG.md#0180---2022-01-17 - https://github.com/Colin-b/pytest_httpx/blob/develop/CHANGELOG.md#0140---2021-10-22 --- setup.py | 2 +- tests/test_async_transport.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 4cf9073b..58a5c24f 100755 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ "freezegun==0.3.15", "pretend==1.0.9", "pytest-cov==2.8.1", - "pytest-httpx", + "pytest-httpx>=0.14", "pytest-asyncio", "pytest==6.2.5", "requests_mock>=0.7.0", diff --git a/tests/test_async_transport.py b/tests/test_async_transport.py index f5e8d1b0..ee215265 100644 --- a/tests/test_async_transport.py +++ b/tests/test_async_transport.py @@ -19,7 +19,7 @@ def test_load(httpx_mock): cache = stub(get=lambda url: None, add=lambda url, content: None) transport = AsyncTransport(cache=cache) - httpx_mock.add_response(url="http://tests.python-zeep.org/test.xml", data="x") + httpx_mock.add_response(url="http://tests.python-zeep.org/test.xml", text="x") result = transport.load("http://tests.python-zeep.org/test.xml") assert result == b"x" @@ -30,7 +30,7 @@ def test_load_cache(httpx_mock): cache = InMemoryCache() transport = AsyncTransport(cache=cache) - httpx_mock.add_response(url="http://tests.python-zeep.org/test.xml", data="x") + httpx_mock.add_response(url="http://tests.python-zeep.org/test.xml", text="x") result = transport.load("http://tests.python-zeep.org/test.xml") assert result == b"x" @@ -45,7 +45,7 @@ async def test_post(httpx_mock: HTTPXMock): envelope = etree.Element("Envelope") - httpx_mock.add_response(url="http://tests.python-zeep.org/test.xml", data="x") + httpx_mock.add_response(url="http://tests.python-zeep.org/test.xml", text="x") result = await transport.post_xml( "http://tests.python-zeep.org/test.xml", envelope=envelope, headers={} ) @@ -67,7 +67,7 @@ async def test_http_error(httpx_mock: HTTPXMock): transport = AsyncTransport() httpx_mock.add_response( - url="http://tests.python-zeep.org/test.xml", data="x", status_code=500 + url="http://tests.python-zeep.org/test.xml", text="x", status_code=500 ) with pytest.raises(exceptions.TransportError) as exc: transport.load("http://tests.python-zeep.org/test.xml") the entries in /gnu/store/.links but only contribute to ~4% of the space savings afforded by deduplication. Not considering these files for deduplication speeds up file insertion in the store and, more importantly, leaves 'removeUnusedLinks' with fewer entries to traverse, thereby speeding it up proportionally. Partly fixes <https://issues.guix.gnu.org/24937>. * config-daemon.ac: Remove symlink hard link check and CAN_LINK_SYMLINK definition. * guix/store/deduplication.scm (%deduplication-minimum-size): New variable. (deduplicate)[loop]: Do not recurse when FILE's size is below %DEDUPLICATION-MINIMUM-SIZE. (dump-port): New procedure. (dump-file/deduplicate)[hash]: Turn into... [dump-and-compute-hash]: ... this thunk. Call 'deduplicate' only when SIZE is greater than %DEDUPLICATION-MINIMUM-SIZE; otherwise call 'dump-port'. * nix/libstore/gc.cc (LocalStore::removeUnusedLinks): Drop files where st.st_size < deduplicationMinSize. * nix/libstore/local-store.hh (deduplicationMinSize): New declaration. * nix/libstore/optimise-store.cc (deduplicationMinSize): New variable. (LocalStore::optimisePath_): Return when PATH is a symlink or smaller than 'deduplicationMinSize'. * tests/derivations.scm ("identical files are deduplicated"): Produce files bigger than %DEDUPLICATION-MINIMUM-SIZE. * tests/nar.scm ("restore-file-set with directories (signed, valid)"): Likewise. * tests/store-deduplication.scm ("deduplicate, below %deduplication-minimum-size"): New test. ("deduplicate", "deduplicate, ENOSPC"): Produce files bigger than %DEDUPLICATION-MINIMUM-SIZE. * tests/store.scm ("substitute, deduplication"): Likewise. Ludovic Courtès 2020-06-06daemon: Handle EXDEV when moving to trash directory....Fixes <https://bugs.gnu.org/41607>. Reported by Stephen Scheck <singularsyntax@gmail.com>. * nix/libstore/gc.cc (LocalStore::deletePathRecursive): When we try to move a dead directory into the trashDir using rename(2) but it returns an EXDEV error, just delete the directory instead. This can happen in a Docker container when the directory is not on the "top layer". Chris Marusich