Skip to content

fix: Resolve small sync/async transform inconsistency, broaden integration coverage#72

Merged
azryve merged 5 commits into
mainfrom
fix/sync-async-inconsistencies
May 12, 2026
Merged

fix: Resolve small sync/async transform inconsistency, broaden integration coverage#72
azryve merged 5 commits into
mainfrom
fix/sync-async-inconsistencies

Conversation

@azryve

@azryve azryve commented May 8, 2026

Copy link
Copy Markdown
Contributor

Running transform_to_sync.py was resulting in a small diff. So I set batch_size=10 everywhere.

diff --git a/src/annetbox/v41/client_sync.py b/src/annetbox/v41/client_sync.py
index 8f4bf9b..95675e6 100644
--- a/src/annetbox/v41/client_sync.py
+++ b/src/annetbox/v41/client_sync.py
@@ -50,9 +50,7 @@ class NetboxV41(BaseNetboxClient):
-    dcim_all_interfaces = collect(
-        dcim_interfaces, field="device_id", batch_size=10,  # heavy request
-    )
+    dcim_all_interfaces = collect(dcim_interfaces, field="device_id")
     dcim_all_interfaces_by_id = collect(dcim_interfaces, field="id")
 
     @get("dcim/interfaces/{id}/")
diff --git a/src/annetbox/v42/client_sync.py b/src/annetbox/v42/client_sync.py
index c9a3866..ca37e10 100644
--- a/src/annetbox/v42/client_sync.py
+++ b/src/annetbox/v42/client_sync.py
@@ -52,9 +52,7 @@ class NetboxV42(BaseNetboxClient):
-    dcim_all_interfaces = collect(
-        dcim_interfaces, field="device_id", batch_size=10,  # heavy request
-    )
+    dcim_all_interfaces = collect(dcim_interfaces, field="device_id")
     dcim_all_interfaces_by_id = collect(dcim_interfaces, field="id")

Summary

  • Fix dcim_all_interfaces using different batch_size between sync and async clients on v41/v42
  • Add dcim_all_interfaces to the integration test fixtures across versions
  • Add test_async_api_call, mirroring test_sync_api_call against the same VCR cassettes so both client flavors are verified to issue equivalent requests and produce equivalent results
  • Bump pytest-asyncio to 1.3.0 to support the new async tests
  • Make the editable install the default in Makefile for local dev

azryve and others added 5 commits May 8, 2026 10:54
… for v41,v42

* add make transform target
* add batch=10 to async client
* run transform
Its more convinient for dev installation.
The installation was copied from setup.yml by mistake.
Reuses the same cassettes to verify sync and async clients issue
equivalent requests. Patches vcrpy's MockClientResponse.release to be
async (real aiohttp returns an awaitable; the stub returns None, which
dataclass_rest's `await response.release()` cannot handle).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Get rid of annoying warnings:

tests/base/test_client_async.py: 4 warnings
tests/integration/test_declarative.py: 31 warnings
  /Users/azryve/src/github/annetbox/.venv/lib/python3.14/site-packages/pytest_asyncio/plugin.py:847: DeprecationWarning: 'asyncio.get_event_loop_policy' is deprecated and slated for removal in Python 3.16
    policy = asyncio.get_event_loop_policy()

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================================ 104 passed, 889 warnings in 6.58s ============================================================
@azryve azryve marked this pull request as ready for review May 11, 2026 15:02
@azryve azryve merged commit 5e61d07 into main May 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants