Skip to content

Commit 1246593

Browse files
committed
refmt
1 parent 9b1dec4 commit 1246593

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

tests/test_Admin.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
IsolationLevel, TopicCollection
1313
import concurrent.futures
1414

15-
# GC module is used to prevent intermittent segfaults in specific Admin tests.
16-
# Tests that make "fire-and-forget" Admin API calls (without waiting for results)
17-
# can leave callbacks queued in librdkafka's background thread. When Python's GC
18-
# runs during subsequent test cleanup, it may try to destroy AdminClient objects while callbacks
19-
# from previous tests are still running in librdkafka's thread. Librdkafka
20-
# forbids calling rd_kafka_destroy() from its own threads and will send an ABORT to crash the tests.
15+
# GC module is used to prevent intermittent segfaults in specific Admin tests:
16+
# - Tests that make "fire-and-forget" Admin API calls (without waiting for results)
17+
# can leave callbacks queued in librdkafka's background thread.
18+
# - When these callbacks allocate Python objects, they may trigger gargabe collection
19+
# - When GC tries to destroy an AdminClient object while running in librdkafka's thread,
20+
# librdkafka (which forbids this) will send an ABORT signal to crash the tests.
2121
import gc
2222

2323

@@ -798,7 +798,9 @@ def test_list_consumer_group_offsets_api():
798798
"test-group1", [TopicPartition("test-topic", 1, 1)])])
799799

800800
a.list_consumer_group_offsets([ConsumerGroupTopicPartitions("test-group1")])
801-
a.list_consumer_group_offsets([ConsumerGroupTopicPartitions("test-group2", [TopicPartition("test-topic1", 1)])])
801+
a.list_consumer_group_offsets([
802+
ConsumerGroupTopicPartitions("test-group2", [TopicPartition("test-topic1", 1)])
803+
])
802804
finally:
803805
gc.enable()
804806

@@ -893,7 +895,9 @@ def test_alter_consumer_group_offsets_api():
893895
a.alter_consumer_group_offsets([ConsumerGroupTopicPartitions("test-group1", [TopicPartition("")])])
894896

895897
with pytest.raises(ValueError):
896-
a.alter_consumer_group_offsets([ConsumerGroupTopicPartitions("test-group1", [TopicPartition("test-topic")])])
898+
a.alter_consumer_group_offsets([
899+
ConsumerGroupTopicPartitions("test-group1", [TopicPartition("test-topic")])
900+
])
897901

898902
with pytest.raises(ValueError):
899903
a.alter_consumer_group_offsets([ConsumerGroupTopicPartitions(
@@ -1018,14 +1022,18 @@ def test_alter_user_scram_credentials_api():
10181022

10191023
# Upsertion salt user test
10201024
with pytest.raises(ValueError):
1021-
a.alter_user_scram_credentials([UserScramCredentialUpsertion("sam", scram_credential_info, b"password", b"")])
1025+
a.alter_user_scram_credentials([
1026+
UserScramCredentialUpsertion("sam", scram_credential_info, b"password", b"")
1027+
])
10221028
with pytest.raises(TypeError):
10231029
a.alter_user_scram_credentials([UserScramCredentialUpsertion("sam",
10241030
scram_credential_info,
10251031
b"password",
10261032
"salt")])
10271033
with pytest.raises(TypeError):
1028-
a.alter_user_scram_credentials([UserScramCredentialUpsertion("sam", scram_credential_info, b"password", 123)])
1034+
a.alter_user_scram_credentials([
1035+
UserScramCredentialUpsertion("sam", scram_credential_info, b"password", 123)
1036+
])
10291037

10301038
# Upsertion scram_credential_info tests
10311039
sci_incorrect_mechanism_type = ScramCredentialInfo("string type", 10000)
@@ -1053,7 +1061,9 @@ def test_alter_user_scram_credentials_api():
10531061
b"password",
10541062
b"salt")])
10551063
with pytest.raises(ValueError):
1056-
a.alter_user_scram_credentials([UserScramCredentialUpsertion("sam", sci_zero_iteration, b"password", b"salt")])
1064+
a.alter_user_scram_credentials([
1065+
UserScramCredentialUpsertion("sam", sci_zero_iteration, b"password", b"salt")
1066+
])
10571067

10581068
# Deletion user tests
10591069
with pytest.raises(TypeError):

0 commit comments

Comments
 (0)