Skip to content

Commit 6e560a4

Browse files
committed
Removes test case that no longer reflects the current implementation
1 parent 34eda1c commit 6e560a4

1 file changed

Lines changed: 1 addition & 32 deletions

File tree

tests/onegov/core/test_orm.py

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from pytz import timezone
3636
from sedate import utcnow
3737
from sqlalchemy import (
38-
and_, event, func, inspect, select, text, ForeignKey, Integer
38+
and_, func, inspect, select, text, ForeignKey, Integer
3939
)
4040
from sqlalchemy.exc import OperationalError
4141
from sqlalchemy.ext.mutable import MutableDict
@@ -178,37 +178,6 @@ def schema_tables(schema: str) -> set[str]:
178178
mgr.dispose()
179179

180180

181-
def test_schema_init_query_count(postgres_dsn: str) -> None:
182-
class Base(DeclarativeBase, ModelBase):
183-
registry = registry()
184-
185-
# create enough tables so the difference between O(1) and O(N) is clear
186-
for i in range(20):
187-
type(f'Table{i}', (Base,), {
188-
'__tablename__': f'table_{i}',
189-
'id': mapped_column(Integer, primary_key=True),
190-
})
191-
192-
mgr = SessionManager(postgres_dsn, Base)
193-
194-
query_count = 0
195-
196-
def count_queries(*args: Any, **kwargs: Any) -> None:
197-
nonlocal query_count
198-
query_count += 1
199-
200-
event.listen(mgr.engine, 'before_cursor_execute', count_queries)
201-
mgr.ensure_schema_exists('test_query_count')
202-
203-
table_count = len(Base.metadata.sorted_tables)
204-
# O(1) implementation: fixed overhead + 1 get_table_names call
205-
# O(N) implementation: fixed overhead + 1 has_table call per table
206-
print('query count:', query_count, 'table count:', table_count)
207-
assert query_count < 2 * table_count
208-
209-
mgr.dispose()
210-
211-
212181
def test_schema_bound_session(postgres_dsn: str) -> None:
213182
class Base(DeclarativeBase, ModelBase):
214183
registry = registry()

0 commit comments

Comments
 (0)