Compare commits

...

3 commits

Author SHA1 Message Date
Simon Willison
f8349b4591
Back to Sanic 0.7.0 2018-11-19 19:52:37 -08:00
Simon Willison
a799ac6232
Updated how we use pytest fixtures to avoid new warning 2018-11-19 18:39:09 -08:00
Simon Willison
b29f25dd6a
Bump dependency versions 2018-11-19 18:22:41 -08:00
3 changed files with 22 additions and 17 deletions

View file

@ -34,11 +34,11 @@ setup(
package_data={'datasette': ['templates/*.html']}, package_data={'datasette': ['templates/*.html']},
include_package_data=True, include_package_data=True,
install_requires=[ install_requires=[
'click==6.7', 'click==7.0',
'click-default-group==1.2', 'click-default-group==1.2',
'Sanic==0.7.0', 'Sanic==0.7.0',
'Jinja2==2.10', 'Jinja2==2.10',
'hupper==1.0', 'hupper==1.4.1',
'pint==0.8.1', 'pint==0.8.1',
'pluggy>=0.7.1', 'pluggy>=0.7.1',
], ],
@ -49,9 +49,9 @@ setup(
setup_requires=['pytest-runner'], setup_requires=['pytest-runner'],
extras_require={ extras_require={
'test': [ 'test': [
'pytest==3.7.1', 'pytest==4.0.0',
'aiohttp==3.3.2', 'aiohttp==3.4.4',
'beautifulsoup4==4.6.1', 'beautifulsoup4==4.6.3',
] ]
}, },
tests_require=[ tests_require=[

View file

@ -23,8 +23,7 @@ class TestClient:
) )
@pytest.fixture(scope="session") def make_app_client(
def app_client(
sql_time_limit_ms=None, sql_time_limit_ms=None,
max_returned_rows=None, max_returned_rows=None,
cors=False, cors=False,
@ -61,38 +60,43 @@ def app_client(
yield client yield client
@pytest.fixture(scope="session")
def app_client(**kwargs):
yield from make_app_client(**kwargs)
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
def app_client_shorter_time_limit(): def app_client_shorter_time_limit():
yield from app_client(20) yield from make_app_client(20)
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
def app_client_returned_rows_matches_page_size(): def app_client_returned_rows_matches_page_size():
yield from app_client(max_returned_rows=50) yield from make_app_client(max_returned_rows=50)
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
def app_client_larger_cache_size(): def app_client_larger_cache_size():
yield from app_client(config={ yield from make_app_client(config={
'cache_size_kb': 2500, 'cache_size_kb': 2500,
}) })
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
def app_client_csv_max_mb_one(): def app_client_csv_max_mb_one():
yield from app_client(config={ yield from make_app_client(config={
'max_csv_mb': 1, 'max_csv_mb': 1,
}) })
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def app_client_with_dot(): def app_client_with_dot():
yield from app_client(filename="fixtures.dot.db") yield from make_app_client(filename="fixtures.dot.db")
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
def app_client_with_cors(): def app_client_with_cors():
yield from app_client(cors=True) yield from make_app_client(cors=True)
def generate_compound_rows(num): def generate_compound_rows(num):

View file

@ -6,6 +6,7 @@ from .fixtures import ( # noqa
app_client_with_dot, app_client_with_dot,
generate_compound_rows, generate_compound_rows,
generate_sortable_rows, generate_sortable_rows,
make_app_client,
METADATA, METADATA,
) )
import pytest import pytest
@ -435,7 +436,7 @@ def test_invalid_custom_sql(app_client):
def test_allow_sql_off(): def test_allow_sql_off():
for client in app_client(config={ for client in make_app_client(config={
'allow_sql': False, 'allow_sql': False,
}): }):
assert 400 == client.get( assert 400 == client.get(
@ -1179,7 +1180,7 @@ def test_suggested_facets(app_client):
def test_allow_facet_off(): def test_allow_facet_off():
for client in app_client(config={ for client in make_app_client(config={
'allow_facet': False, 'allow_facet': False,
}): }):
assert 400 == client.get( assert 400 == client.get(
@ -1192,7 +1193,7 @@ def test_allow_facet_off():
def test_suggest_facets_off(): def test_suggest_facets_off():
for client in app_client(config={ for client in make_app_client(config={
'suggest_facets': False, 'suggest_facets': False,
}): }):
# Now suggested_facets should be [] # Now suggested_facets should be []
@ -1304,7 +1305,7 @@ def test_config_cache_size(app_client_larger_cache_size):
def test_config_force_https_urls(): def test_config_force_https_urls():
for client in app_client(config={"force_https_urls": True}): for client in make_app_client(config={"force_https_urls": True}):
response = client.get("/fixtures/facetable.json?_size=3&_facet=state") response = client.get("/fixtures/facetable.json?_size=3&_facet=state")
assert response.json["next_url"].startswith("https://") assert response.json["next_url"].startswith("https://")
assert response.json["facet_results"]["state"]["results"][0][ assert response.json["facet_results"]["state"]["results"][0][