Skip to content

Commit d344af5

Browse files
committed
chore(cassandra): skip doctest in Python 3.14 while there is no available driver
1 parent afd0356 commit d344af5

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

modules/cassandra/testcontainers/cassandra/__init__.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,28 @@ class CassandraContainer(DockerContainer):
2020
2121
Example:
2222
23-
.. doctest::
23+
.. testsetup:: cassandra_container
24+
25+
import sys
26+
import doctest
27+
from importlib.metadata import PackageNotFoundError, version
28+
29+
from packaging.version import Version
30+
31+
try:
32+
cassandra_driver_version =
33+
except PackageNotFoundError:
34+
cassandra_driver_version = None
35+
36+
if (
37+
Version(version("cassandra-driver")) <= Version("3.29.3")
38+
and sys.version_info > (3, 14)
39+
):
40+
raise doctest.SkipTest(
41+
"cassandra-driver <= 3.29.3 is incompatible with Python > 3.14"
42+
)
43+
44+
.. doctest:: cassandra_container
2445
2546
>>> from testcontainers.cassandra import CassandraContainer
2647
>>> from cassandra.cluster import Cluster, DCAwareRoundRobinPolicy

0 commit comments

Comments
 (0)