MCPcopy
hub / github.com/psycopg/psycopg / check_crdb_version

Function check_crdb_version

tests/fix_crdb.py:23–47  ·  view source on GitHub ↗
(got, mark)

Source from the content-addressed store, hash-verified

21
22
23def check_crdb_version(got, mark):
24 if mark.name == "crdb":
25 assert len(mark.args) <= 1
26 assert not (set(mark.kwargs) - {"reason"})
27 spec = mark.args[0] if mark.args else "only"
28 reason = mark.kwargs.get("reason")
29 elif mark.name == "crdb_skip":
30 assert len(mark.args) == 1
31 assert not mark.kwargs
32 reason = mark.args[0]
33 assert reason in _crdb_reasons, reason
34 spec = _crdb_reason_version.get(reason, "skip")
35 else:
36 assert False, mark.name
37
38 pred = VersionCheck.parse(spec)
39 pred.whose = "CockroachDB"
40
41 if not (msg := pred.get_skip_message(got)):
42 return None
43
44 if reason := crdb_skip_message(reason):
45 msg = f"{msg}: {reason}"
46
47 return msg
48
49
50# Utility functions which can be imported in the test suite

Callers 1

check_connection_versionFunction · 0.85

Calls 4

crdb_skip_messageFunction · 0.85
get_skip_messageMethod · 0.80
getMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected