-
Notifications
You must be signed in to change notification settings - Fork 914
Refactor for async support #1971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
🎉 All Contributor License Agreements have been signed. Ready to merge. |
…support src/confluent_kafka/schema_registry/avro.py (change applied to src/confluent_kafka/schema_registry/_sync/avro.py)
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
with (patch("confluent_kafka.schema_registry.schema_registry_client.time.sleep") as mock_sleep, | ||
patch("confluent_kafka.schema_registry.schema_registry_client.full_jitter") as mock_jitter): | ||
with (patch("confluent_kafka.schema_registry._sync.schema_registry_client.time.sleep") as mock_sleep, | ||
patch("confluent_kafka.schema_registry._sync.schema_registry_client.full_jitter") as mock_jitter): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unittest.mock.patch
needs to be used directly with the module that defines the function to be patched, hence this change.
What
This PR refactors the schema registry modules across a newly introduced
_sync
package, as well as thecommon
package. The PR that introduces the_async
package is stacked onto this one, see #1965.To illustrate the changes made, let's take
src/confluent_kafka/schema_registry/schema_registry_client.py
for example:src/confluent_kafka/schema_registry/common/schema_registry_client.py
-- this package is intended to house functionality that is common to both the sync and async implementations.SchemaRegistryClient
and its dependent classes were moved intosrc/confluent_kafka/schema_registry/_sync/schema_registry_client.py
src/schema_registry/schema_registry_client.py
was refactored to only contain imports from thecommon.schema_registry_client
and_sync.schema_registry_client
modules. This is done so that users relying on imports directly fromconfluent_kafka.schema_registry.schema_registry_client
don't encounter any breaking/missing imports.The above treatment was applied to:
schema_registry_client.py
(as demonstrated),avro.py
,json_schema.py
,protobuf.py
andserde.py
.Other changes:
_sync
(with minimal changes).Checklist
References
JIRA:
Test & Review
Open questions / Follow-ups