1010from feast .infra .online_stores .cassandra_online_store import ( # noqa: E402
1111 cassandra_online_store as _cos ,
1212)
13- from feast .repo_config import RepoConfig # noqa: E402
13+ from feast .repo_config import RepoConfig # noqa: E402
1414
1515CassandraInvalidConfig = _cos .CassandraInvalidConfig
1616CassandraOnlineStore = _cos .CassandraOnlineStore
2727
2828# Path to patch so tests never open a real Cassandra connection
2929_CLUSTER_PATH = (
30- "feast.infra.online_stores"
31- ".cassandra_online_store"
32- ".cassandra_online_store.Cluster"
30+ "feast.infra.online_stores.cassandra_online_store.cassandra_online_store.Cluster"
3331)
3432
3533
@@ -118,10 +116,7 @@ def test_datacenter_replication_fields_parse(self):
118116 ],
119117 )
120118 assert cfg .datacenters [0 ].replication_factor == 3
121- assert (
122- cfg .datacenters [0 ].replication_strategy
123- == "NetworkTopologyStrategy"
124- )
119+ assert cfg .datacenters [0 ].replication_strategy == "NetworkTopologyStrategy"
125120
126121 def test_datacenter_replication_fields_default_to_none (self ):
127122 cfg = CassandraOnlineStoreConfig (
@@ -172,9 +167,7 @@ class TestCassandraMultiDCValidation:
172167 Validation errors that _get_session raises before touching the driver.
173168 """
174169
175- def test_datacenters_and_hosts_are_mutually_exclusive (
176- self , mock_cluster
177- ):
170+ def test_datacenters_and_hosts_are_mutually_exclusive (self , mock_cluster ):
178171 store = CassandraOnlineStore ()
179172 cfg = _repo_config (
180173 CassandraOnlineStoreConfig (
@@ -188,9 +181,7 @@ def test_datacenters_and_hosts_are_mutually_exclusive(
188181 ):
189182 store ._get_session (cfg )
190183
191- def test_datacenters_and_secure_bundle_are_mutually_exclusive (
192- self , mock_cluster
193- ):
184+ def test_datacenters_and_secure_bundle_are_mutually_exclusive (self , mock_cluster ):
194185 store = CassandraOnlineStore ()
195186 cfg = _repo_config (
196187 CassandraOnlineStoreConfig (
@@ -206,17 +197,11 @@ def test_datacenters_and_secure_bundle_are_mutually_exclusive(
206197
207198 def test_empty_datacenters_list_raises (self , mock_cluster ):
208199 store = CassandraOnlineStore ()
209- cfg = _repo_config (
210- CassandraOnlineStoreConfig (keyspace = "ks" , datacenters = [])
211- )
212- with pytest .raises (
213- CassandraInvalidConfig , match = E_CASSANDRA_DC_CONFIG_EMPTY
214- ):
200+ cfg = _repo_config (CassandraOnlineStoreConfig (keyspace = "ks" , datacenters = []))
201+ with pytest .raises (CassandraInvalidConfig , match = E_CASSANDRA_DC_CONFIG_EMPTY ):
215202 store ._get_session (cfg )
216203
217- def test_load_balancing_local_dc_not_in_datacenters_raises (
218- self , mock_cluster
219- ):
204+ def test_load_balancing_local_dc_not_in_datacenters_raises (self , mock_cluster ):
220205 store = CassandraOnlineStore ()
221206 cfg = _repo_config (
222207 CassandraOnlineStoreConfig (
@@ -346,9 +331,7 @@ def test_default_dc_fallback_to_first_entry_when_no_load_balancing(
346331 profiles = mock_cls .call_args .kwargs ["execution_profiles" ]
347332 assert profiles [EXEC_PROFILE_DEFAULT ] is profiles ["dc1" ]
348333
349- def test_all_dc_hosts_merged_into_cluster_contact_points (
350- self , mock_cluster
351- ):
334+ def test_all_dc_hosts_merged_into_cluster_contact_points (self , mock_cluster ):
352335 """
353336 Cluster() must receive the union of all DC hosts as contact points.
354337 """
@@ -390,9 +373,7 @@ def test_routing_read_dc_sets_read_execution_profile(self, mock_cluster):
390373 store ._get_session (cfg )
391374 assert store ._read_execution_profile == "dc2"
392375
393- def test_routing_write_dc_sets_write_execution_profile (
394- self , mock_cluster
395- ):
376+ def test_routing_write_dc_sets_write_execution_profile (self , mock_cluster ):
396377 mock_cls , mock_session = mock_cluster
397378 store = CassandraOnlineStore ()
398379 cfg = _repo_config (
@@ -409,9 +390,7 @@ def test_routing_write_dc_sets_write_execution_profile(
409390 store ._get_session (cfg )
410391 assert store ._write_execution_profile == "dc1"
411392
412- def test_no_routing_block_uses_default_dc_for_both_ops (
413- self , mock_cluster
414- ):
393+ def test_no_routing_block_uses_default_dc_for_both_ops (self , mock_cluster ):
415394 """Without a routing block, both read and write use the default DC."""
416395 mock_cls , mock_session = mock_cluster
417396 store = CassandraOnlineStore ()
@@ -429,9 +408,7 @@ def test_no_routing_block_uses_default_dc_for_both_ops(
429408 assert store ._read_execution_profile == "dc1"
430409 assert store ._write_execution_profile == "dc1"
431410
432- def test_partial_routing_missing_read_dc_falls_back_to_default (
433- self , mock_cluster
434- ):
411+ def test_partial_routing_missing_read_dc_falls_back_to_default (self , mock_cluster ):
435412 """routing.read_dc omitted → reads use default DC."""
436413 mock_cls , mock_session = mock_cluster
437414 store = CassandraOnlineStore ()
@@ -497,9 +474,7 @@ def test_branch_a_hosts_creates_session(self, mock_cluster):
497474 mock_cls , mock_session = mock_cluster
498475 store = CassandraOnlineStore ()
499476 cfg = _repo_config (
500- CassandraOnlineStoreConfig (
501- hosts = ["127.0.0.1" ], port = 9042 , keyspace = "ks"
502- )
477+ CassandraOnlineStoreConfig (hosts = ["127.0.0.1" ], port = 9042 , keyspace = "ks" )
503478 )
504479 session = store ._get_session (cfg )
505480
0 commit comments