Default tests to using a longer timelimit

Every now and then a test will fail in Travis CI on Python 3.5 because it hit
the default 20ms SQL time limit.

Test fixtures now default to a 200ms time limit, and we only use the 20ms time
limit for the specific test that tests query interruption. This should make
our tests on Python 3.5 in Travis much more stable.
distinct-column-values
Simon Willison 2018-05-05 19:41:37 -03:00
rodzic 1259b8ac0b
commit 801381b765
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 17E2DEA2588B7F52
2 zmienionych plików z 11 dodań i 11 usunięć

Wyświetl plik

@ -22,7 +22,7 @@ def app_client(sql_time_limit_ms=None, max_returned_rows=None):
[filepath],
page_size=50,
max_returned_rows=max_returned_rows or 100,
sql_time_limit_ms=sql_time_limit_ms or 20,
sql_time_limit_ms=sql_time_limit_ms or 200,
metadata=METADATA,
plugins_dir=plugins_dir,
)
@ -34,8 +34,8 @@ def app_client(sql_time_limit_ms=None, max_returned_rows=None):
yield client
def app_client_longer_time_limit():
yield from app_client(200)
def app_client_shorter_time_limit():
yield from app_client(20)
def app_client_returend_rows_matches_page_size():

Wyświetl plik

@ -1,6 +1,6 @@
from .fixtures import (
app_client,
app_client_longer_time_limit,
app_client_shorter_time_limit,
app_client_returend_rows_matches_page_size,
generate_compound_rows,
generate_sortable_rows,
@ -9,7 +9,7 @@ from .fixtures import (
import pytest
pytest.fixture(scope='module')(app_client)
pytest.fixture(scope='module')(app_client_longer_time_limit)
pytest.fixture(scope='module')(app_client_shorter_time_limit)
pytest.fixture(scope='module')(app_client_returend_rows_matches_page_size)
@ -303,8 +303,8 @@ def test_custom_sql(app_client):
assert not data['truncated']
def test_sql_time_limit(app_client):
response = app_client.get(
def test_sql_time_limit(app_client_shorter_time_limit):
response = app_client_shorter_time_limit.get(
'/test_tables.json?sql=select+sleep(0.5)',
gather_request=False
)
@ -504,11 +504,11 @@ def test_table_with_reserved_word_name(app_client):
('/test_tables/paginated_view.json?_size=max', 201, 3),
('/test_tables/123_starts_with_digits.json', 0, 1),
])
def test_paginate_tables_and_views(app_client_longer_time_limit, path, expected_rows, expected_pages):
def test_paginate_tables_and_views(app_client, path, expected_rows, expected_pages):
fetched = []
count = 0
while path:
response = app_client_longer_time_limit.get(path, gather_request=False)
response = app_client.get(path, gather_request=False)
assert 200 == response.status
count += 1
fetched.extend(response.json['rows'])
@ -544,13 +544,13 @@ def test_page_size_zero(app_client):
assert None is response.json['next_url']
def test_paginate_compound_keys(app_client_longer_time_limit):
def test_paginate_compound_keys(app_client):
fetched = []
path = '/test_tables/compound_three_primary_keys.json?_shape=objects'
page = 0
while path:
page += 1
response = app_client_longer_time_limit.get(path, gather_request=False)
response = app_client.get(path, gather_request=False)
fetched.extend(response.json['rows'])
path = response.json['next_url']
assert page < 100