pytest-kafka-broker 0.2.0__py3-none-any.whl → 0.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pytest_kafka_broker/__init__.py +9 -1
- {pytest_kafka_broker-0.2.0.dist-info → pytest_kafka_broker-0.3.1.dist-info}/METADATA +1 -1
- pytest_kafka_broker-0.3.1.dist-info/RECORD +7 -0
- pytest_kafka_broker-0.2.0.dist-info/RECORD +0 -7
- {pytest_kafka_broker-0.2.0.dist-info → pytest_kafka_broker-0.3.1.dist-info}/WHEEL +0 -0
- {pytest_kafka_broker-0.2.0.dist-info → pytest_kafka_broker-0.3.1.dist-info}/entry_points.txt +0 -0
- {pytest_kafka_broker-0.2.0.dist-info → pytest_kafka_broker-0.3.1.dist-info}/top_level.txt +0 -0
pytest_kafka_broker/__init__.py
CHANGED
|
@@ -12,6 +12,7 @@ import pytest_asyncio
|
|
|
12
12
|
from astropy.config import get_cache_dir_path # type: ignore[import-untyped]
|
|
13
13
|
from astropy.utils.data import get_readable_fileobj # type: ignore[import-untyped]
|
|
14
14
|
from confluent_kafka import Consumer, Producer
|
|
15
|
+
from confluent_kafka.admin import AdminClient
|
|
15
16
|
from confluent_kafka.aio import AIOConsumer, AIOProducer
|
|
16
17
|
from rich.status import Status
|
|
17
18
|
|
|
@@ -87,6 +88,9 @@ class KafkaBrokerContext:
|
|
|
87
88
|
def config(self, config: dict | None = None) -> dict:
|
|
88
89
|
return {**(config or {}), "bootstrap.servers": self.bootstrap_server}
|
|
89
90
|
|
|
91
|
+
def admin(self, config: dict | None = None) -> AdminClient:
|
|
92
|
+
return AdminClient(self.config(config))
|
|
93
|
+
|
|
90
94
|
def producer(self, config: dict | None = None) -> Producer:
|
|
91
95
|
return Producer(self.config(config))
|
|
92
96
|
|
|
@@ -100,6 +104,7 @@ class KafkaBrokerContext:
|
|
|
100
104
|
return AIOConsumer(self.config(config))
|
|
101
105
|
|
|
102
106
|
config.__doc__ = _doc.format("Get the configuration for a Kafka client.")
|
|
107
|
+
admin.__doc__ = _doc.format("Create a Kafka admin client connected to the cluster.")
|
|
103
108
|
producer.__doc__ = _doc.format("Create a Kafka producer connected to the cluster.")
|
|
104
109
|
consumer.__doc__ = _doc.format("Create a Kafka consumer connected to the cluster.")
|
|
105
110
|
aio_producer.__doc__ = _doc.format(
|
|
@@ -181,5 +186,8 @@ async def kafka_broker(
|
|
|
181
186
|
yield KafkaBrokerContext(f"127.0.0.1:{plaintext_port}")
|
|
182
187
|
finally:
|
|
183
188
|
with Status("Stopping Kafka broker"):
|
|
184
|
-
|
|
189
|
+
try:
|
|
190
|
+
process.terminate()
|
|
191
|
+
except ProcessLookupError:
|
|
192
|
+
pass # Process has already terminated
|
|
185
193
|
await exited
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
pytest_kafka_broker/__init__.py,sha256=1-dEGoWlajumAl7AWsYARbxi9wKlBwTh56sg1KSLC5g,6511
|
|
2
|
+
pytest_kafka_broker/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
pytest_kafka_broker-0.3.1.dist-info/METADATA,sha256=_31JrO09YK79CS6ly65rCWZdQEuaFcF_dUBG7lKx-KE,683
|
|
4
|
+
pytest_kafka_broker-0.3.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
5
|
+
pytest_kafka_broker-0.3.1.dist-info/entry_points.txt,sha256=mjFsRbu6FOiZkUOlSaXpo4QdLHwniNB-p_NEIgRbDnw,46
|
|
6
|
+
pytest_kafka_broker-0.3.1.dist-info/top_level.txt,sha256=nTrYx9xVeK5hsqbhBRL2bgBV_ea-J66_f4Dk8eD-Ci0,20
|
|
7
|
+
pytest_kafka_broker-0.3.1.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
pytest_kafka_broker/__init__.py,sha256=H31mMYb-7j90GOaoaOmh12Fj50i7SRTEhX7l8MC6vbM,6148
|
|
2
|
-
pytest_kafka_broker/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
pytest_kafka_broker-0.2.0.dist-info/METADATA,sha256=XLPnJeSqqZXMYSuY5GPYZBFsSheAaVmfA1BXSYfZgtw,683
|
|
4
|
-
pytest_kafka_broker-0.2.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
5
|
-
pytest_kafka_broker-0.2.0.dist-info/entry_points.txt,sha256=mjFsRbu6FOiZkUOlSaXpo4QdLHwniNB-p_NEIgRbDnw,46
|
|
6
|
-
pytest_kafka_broker-0.2.0.dist-info/top_level.txt,sha256=nTrYx9xVeK5hsqbhBRL2bgBV_ea-J66_f4Dk8eD-Ci0,20
|
|
7
|
-
pytest_kafka_broker-0.2.0.dist-info/RECORD,,
|
|
File without changes
|
{pytest_kafka_broker-0.2.0.dist-info → pytest_kafka_broker-0.3.1.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|