Longer time limit for test_paginate_compound_keys

It was failing intermittently in Travis - see #209
pull/222/head
Simon Willison 2018-04-17 18:08:51 -07:00
rodzic 5ebc7137d7
commit aaf59db570
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 17E2DEA2588B7F52
2 zmienionych plików z 10 dodań i 4 usunięć

Wyświetl plik

@ -9,7 +9,7 @@ import tempfile
import time
def app_client():
def app_client(sql_time_limit_ms=None):
with tempfile.TemporaryDirectory() as tmpdir:
filepath = os.path.join(tmpdir, 'test_tables.db')
conn = sqlite3.connect(filepath)
@ -22,7 +22,7 @@ def app_client():
[filepath],
page_size=50,
max_returned_rows=100,
sql_time_limit_ms=20,
sql_time_limit_ms=sql_time_limit_ms or 20,
metadata=METADATA,
plugins_dir=plugins_dir,
)
@ -32,6 +32,10 @@ def app_client():
yield ds.app().test_client
def app_client_longer_time_limit():
yield from app_client(200)
def generate_compound_rows(num):
for a, b, c in itertools.islice(
itertools.product(string.ascii_lowercase, repeat=3), num

Wyświetl plik

@ -1,11 +1,13 @@
from .fixtures import (
app_client,
app_client_longer_time_limit,
generate_compound_rows,
generate_sortable_rows,
)
import pytest
pytest.fixture(scope='module')(app_client)
pytest.fixture(scope='module')(app_client_longer_time_limit)
def test_homepage(app_client):
@ -387,13 +389,13 @@ def test_paginate_tables_and_views(app_client, path, expected_rows, expected_pag
assert expected_pages == count
def test_paginate_compound_keys(app_client):
def test_paginate_compound_keys(app_client_longer_time_limit):
fetched = []
path = '/test_tables/compound_three_primary_keys.json?_shape=objects'
page = 0
while path:
page += 1
response = app_client.get(path, gather_request=False)
response = app_client_longer_time_limit.get(path, gather_request=False)
fetched.extend(response.json['rows'])
path = response.json['next_url']
assert page < 100