Skip to content

Commit 39740bd

Browse files
committed
[NOGIL] Split schema_registry tests to narrow free-threaded test exclusions (#2309)
* [NOGIL] Split schema_registry tests to narrow free-threaded test exclusions Each of test_avro_serdes.py, test_config.py, test_json_serdes.py, and test_proto_serdes.py is split into a plain file (no rules/encryption dependency) and a _rules file (CEL/encryption/JSONata-dependent tests). This lets the plain tests run on free-threaded (3.14t) builds, where tink/celpy/orjson have no free-threaded wheels, while only the _rules files stay excluded via conftest.py's collect_ignore. * Fix isort/black formatting in split schema_registry tests
1 parent 3f5db5b commit 39740bd

17 files changed

Lines changed: 7986 additions & 7575 deletions

tests/schema_registry/_async/test_avro_serdes.py

Lines changed: 1 addition & 2001 deletions
Large diffs are not rendered by default.

tests/schema_registry/_async/test_avro_serdes_rules.py

Lines changed: 2053 additions & 0 deletions
Large diffs are not rendered by default.

tests/schema_registry/_async/test_config.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323

2424
from confluent_kafka.schema_registry import AsyncSchemaRegistryClient
2525
from confluent_kafka.schema_registry.common.schema_registry_client import normalize_identity_pool
26-
from confluent_kafka.schema_registry.rules.encryption.encrypt_executor import FieldEncryptionExecutor
27-
from confluent_kafka.schema_registry.serde import RuleError
2826

2927
TEST_URL = 'http://SchemaRegistry:65534'
3028
TEST_USERNAME = 'sr_user'
@@ -402,30 +400,6 @@ def test_config_unknown_prop():
402400
AsyncSchemaRegistryClient(conf)
403401

404402

405-
def test_config_encrypt_executor():
406-
executor = FieldEncryptionExecutor()
407-
client_conf = {'url': 'mock://'}
408-
rule_conf = {'key': 'value'}
409-
executor.configure(client_conf, rule_conf)
410-
# configure with same args is fine
411-
executor.configure(client_conf, rule_conf)
412-
rule_conf2 = {'key2': 'value2'}
413-
# configure with additional rule_conf keys is fine
414-
executor.configure(client_conf, rule_conf2)
415-
416-
client_conf2 = {
417-
'url': 'mock://',
418-
'ssl.key.location': '/ssl/keys/client',
419-
'ssl.certificate.location': '/ssl/certs/client',
420-
}
421-
with pytest.raises(RuleError, match="executor already configured"):
422-
executor.configure(client_conf2, rule_conf)
423-
424-
rule_conf3 = {'key': 'value3'}
425-
with pytest.raises(RuleError, match="rule config key already set: key"):
426-
executor.configure(client_conf, rule_conf3)
427-
428-
429403
def test_normalize_identity_pool_none():
430404
assert normalize_identity_pool(None) is None
431405

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
#
4+
# Copyright 2026 Confluent Inc.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
import pytest
19+
20+
from confluent_kafka.schema_registry.rules.encryption.encrypt_executor import FieldEncryptionExecutor
21+
from confluent_kafka.schema_registry.serde import RuleError
22+
23+
"""
24+
Tests for config handling that depend on the rules extra (tink/celpy) and
25+
are excluded from collection on free-threaded builds -- see
26+
tests/schema_registry/conftest.py.
27+
"""
28+
29+
30+
def test_config_encrypt_executor():
31+
executor = FieldEncryptionExecutor()
32+
client_conf = {'url': 'mock://'}
33+
rule_conf = {'key': 'value'}
34+
executor.configure(client_conf, rule_conf)
35+
# configure with same args is fine
36+
executor.configure(client_conf, rule_conf)
37+
rule_conf2 = {'key2': 'value2'}
38+
# configure with additional rule_conf keys is fine
39+
executor.configure(client_conf, rule_conf2)
40+
41+
client_conf2 = {
42+
'url': 'mock://',
43+
'ssl.key.location': '/ssl/keys/client',
44+
'ssl.certificate.location': '/ssl/certs/client',
45+
}
46+
with pytest.raises(RuleError, match="executor already configured"):
47+
executor.configure(client_conf2, rule_conf)
48+
49+
rule_conf3 = {'key': 'value3'}
50+
with pytest.raises(RuleError, match="rule config key already set: key"):
51+
executor.configure(client_conf, rule_conf3)

0 commit comments

Comments
 (0)