Skip to content

Commit 3782303

Browse files
Fix requirements.py to return exclusion objects instead of booleans
SuiteRequirements properties must return exclusions.open()/closed() objects, not bare booleans. The test runner calls .enabled_for_config() on these values which fails on bool. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c7fae0b commit 3782303

2 files changed

Lines changed: 47 additions & 14 deletions

File tree

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
"""SQLAlchemy test suite requirements for dqlite dialect."""
22

3+
# mypy: disable-error-code="no-untyped-call"
4+
5+
from typing import Any
6+
7+
from sqlalchemy.testing import exclusions
38
from sqlalchemy.testing.requirements import SuiteRequirements
49

510

@@ -10,36 +15,36 @@ class Requirements(SuiteRequirements):
1015
"""
1116

1217
@property
13-
def datetime_literals(self) -> bool:
18+
def datetime_literals(self) -> Any:
1419
"""dqlite/SQLite doesn't have native datetime literals."""
15-
return False
20+
return exclusions.closed()
1621

1722
@property
18-
def time_microseconds(self) -> bool:
23+
def time_microseconds(self) -> Any:
1924
"""SQLite stores time as text without microseconds."""
20-
return False
25+
return exclusions.closed()
2126

2227
@property
23-
def datetime_historic(self) -> bool:
28+
def datetime_historic(self) -> Any:
2429
"""SQLite date range limitation."""
25-
return False
30+
return exclusions.closed()
2631

2732
@property
28-
def unicode_ddl(self) -> bool:
33+
def unicode_ddl(self) -> Any:
2934
"""SQLite supports unicode in DDL."""
30-
return True
35+
return exclusions.open()
3136

3237
@property
33-
def savepoints(self) -> bool:
38+
def savepoints(self) -> Any:
3439
"""dqlite supports savepoints."""
35-
return True
40+
return exclusions.open()
3641

3742
@property
38-
def two_phase_transactions(self) -> bool:
43+
def two_phase_transactions(self) -> Any:
3944
"""dqlite doesn't support two-phase transactions."""
40-
return False
45+
return exclusions.closed()
4146

4247
@property
43-
def temp_table_reflection(self) -> bool:
48+
def temp_table_reflection(self) -> Any:
4449
"""SQLite supports temp table reflection."""
45-
return True
50+
return exclusions.open()

tests/test_requirements.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""Tests for dialect requirements."""
2+
3+
from sqlalchemydqlite.requirements import Requirements
4+
5+
6+
class TestRequirements:
7+
def test_properties_return_exclusion_objects(self) -> None:
8+
"""All requirement properties must return exclusion objects, not bare booleans."""
9+
req = Requirements()
10+
properties = [
11+
"datetime_literals",
12+
"time_microseconds",
13+
"datetime_historic",
14+
"unicode_ddl",
15+
"savepoints",
16+
"two_phase_transactions",
17+
"temp_table_reflection",
18+
]
19+
for prop_name in properties:
20+
value = getattr(req, prop_name)
21+
assert not isinstance(value, bool), (
22+
f"Requirements.{prop_name} returns a bare bool; "
23+
f"should return exclusions.open() or exclusions.closed()"
24+
)
25+
# Should have the enabled_for_config method used by the test runner
26+
assert hasattr(value, "enabled_for_config"), (
27+
f"Requirements.{prop_name} return value lacks enabled_for_config method"
28+
)

0 commit comments

Comments
 (0)