-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
14 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
from helpers import for_one_database, open_cursor | ||
from query_fixture import query_fixture | ||
import pytest | ||
from helpers import for_one_database # , open_cursor | ||
|
||
# from query_fixture import query_fixture | ||
|
||
|
||
@for_one_database | ||
def test_many_batches_with_async_io(dsn, configuration): | ||
with open_cursor(configuration, use_async_io=True) as cursor: | ||
with query_fixture(cursor, configuration, "INSERT INTEGER") as table_name: | ||
# insert 2^16 rows | ||
cursor.execute(f"INSERT INTO {table_name} VALUES (1)") | ||
for _ in range(16): | ||
cursor.execute(f"INSERT INTO {table_name} SELECT * FROM {table_name}") | ||
|
||
cursor.execute(f"SELECT * FROM {table_name}") | ||
assert sum(1 for _ in cursor) == 2**16 | ||
pytest.skip("async_io will be removed in future") | ||
# with open_cursor(configuration, use_async_io=True) as cursor: | ||
# with query_fixture(cursor, configuration, "INSERT INTEGER") as table_name: | ||
# # insert 2^16 rows | ||
# cursor.execute(f"INSERT INTO {table_name} VALUES (1)") | ||
# for _ in range(16): | ||
# cursor.execute(f"INSERT INTO {table_name} SELECT * FROM {table_name}") | ||
|
||
# cursor.execute(f"SELECT * FROM {table_name}") | ||
# assert sum(1 for _ in cursor) == 2**16 |