From 9c43b4164db4f60a0be912cfdb07ef8c58b36b22 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Fri, 16 Dec 2022 13:51:46 -0800 Subject: [PATCH] Removed @pytest.mark.ds_client mark - refs #1959 I don't need it - can run 'pytest -k ds_client' instead. See https://github.com/simonw/datasette/pull/1960#issuecomment-1355685828 --- pytest.ini | 1 - tests/test_api.py | 17 ------------ tests/test_auth.py | 9 ------- tests/test_canned_queries.py | 1 - tests/test_csv.py | 10 -------- tests/test_facets.py | 13 ---------- tests/test_filters.py | 4 --- tests/test_html.py | 40 ----------------------------- tests/test_internal_db.py | 5 ---- tests/test_messages.py | 2 -- tests/test_permissions.py | 2 -- tests/test_plugins.py | 42 ------------------------------ tests/test_table_api.py | 50 ------------------------------------ tests/test_table_html.py | 38 --------------------------- 14 files changed, 234 deletions(-) diff --git a/pytest.ini b/pytest.ini index 0bcb0d1e..559e518c 100644 --- a/pytest.ini +++ b/pytest.ini @@ -8,5 +8,4 @@ filterwarnings= ignore:.*current_task.*:PendingDeprecationWarning markers = serial: tests to avoid using with pytest-xdist - ds_client: tests using the ds_client fixture asyncio_mode = strict diff --git a/tests/test_api.py b/tests/test_api.py index 8bd1e8b7..48bca8b3 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -23,7 +23,6 @@ import sys import urllib -@pytest.mark.ds_client @pytest.mark.asyncio async def test_homepage(ds_client): response = await ds_client.get("/.json") @@ -43,7 +42,6 @@ async def test_homepage(ds_client): assert d["views_count"] == 4 -@pytest.mark.ds_client @pytest.mark.asyncio async def test_homepage_sort_by_relationships(ds_client): response = await ds_client.get("/.json?_sort=relationships") @@ -60,7 +58,6 @@ async def test_homepage_sort_by_relationships(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_database_page(ds_client): response = await ds_client.get("/fixtures.json") @@ -640,7 +637,6 @@ def test_database_page_for_database_with_dot_in_name(app_client_with_dot): assert response.status == 200 -@pytest.mark.ds_client @pytest.mark.asyncio async def test_custom_sql(ds_client): response = await ds_client.get( @@ -682,7 +678,6 @@ def test_sql_time_limit(app_client_shorter_time_limit): } -@pytest.mark.ds_client @pytest.mark.asyncio async def test_custom_sql_time_limit(ds_client): response = await ds_client.get("/fixtures.json?sql=select+sleep(0.01)") @@ -692,7 +687,6 @@ async def test_custom_sql_time_limit(ds_client): assert response.json()["title"] == "SQL Interrupted" -@pytest.mark.ds_client @pytest.mark.asyncio async def test_invalid_custom_sql(ds_client): response = await ds_client.get("/fixtures.json?sql=.schema") @@ -701,7 +695,6 @@ async def test_invalid_custom_sql(ds_client): assert "Statement must be a SELECT" == response.json()["error"] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_row(ds_client): response = await ds_client.get("/fixtures/simple_primary_key/1.json?_shape=objects") @@ -709,7 +702,6 @@ async def test_row(ds_client): assert response.json()["rows"] == [{"id": "1", "content": "hello"}] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_row_strange_table_name(ds_client): response = await ds_client.get( @@ -719,7 +711,6 @@ async def test_row_strange_table_name(ds_client): assert response.json()["rows"] == [{"pk": "3", "content": "hey"}] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_row_foreign_key_tables(ds_client): response = await ds_client.get( @@ -781,14 +772,12 @@ def test_databases_json(app_client_two_attached_databases_one_immutable): assert False == fixtures_database["is_memory"] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_metadata_json(ds_client): response = await ds_client.get("/-/metadata.json") assert response.json() == METADATA -@pytest.mark.ds_client @pytest.mark.asyncio async def test_threads_json(ds_client): response = await ds_client.get("/-/threads.json") @@ -798,7 +787,6 @@ async def test_threads_json(ds_client): assert set(response.json().keys()) == expected_keys -@pytest.mark.ds_client @pytest.mark.asyncio async def test_plugins_json(ds_client): response = await ds_client.get("/-/plugins.json") @@ -810,7 +798,6 @@ async def test_plugins_json(ds_client): assert names.issuperset(DEFAULT_PLUGINS) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_versions_json(ds_client): response = await ds_client.get("/-/versions.json") @@ -828,7 +815,6 @@ async def test_versions_json(ds_client): assert "compile_options" in data["sqlite"] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_settings_json(ds_client): response = await ds_client.get("/-/settings.json") @@ -858,7 +844,6 @@ async def test_settings_json(ds_client): } -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected_redirect", @@ -878,7 +863,6 @@ test_json_columns_default_expected = [ ] -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "extra_args,expected", @@ -1000,7 +984,6 @@ def test_inspect_file_used_for_count(app_client_immutable_and_inspect_file): assert response.json["filtered_table_rows_count"] == 100 -@pytest.mark.ds_client @pytest.mark.asyncio async def test_http_options_request(ds_client): response = await ds_client.options("/fixtures") diff --git a/tests/test_auth.py b/tests/test_auth.py index bc5c6a2b..33cf9b35 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -8,7 +8,6 @@ import pytest import time -@pytest.mark.ds_client @pytest.mark.asyncio async def test_auth_token(ds_client): """The /-/auth-token endpoint sets the correct cookie""" @@ -25,7 +24,6 @@ async def test_auth_token(ds_client): assert (await ds_client.get(path)).status_code == 403 -@pytest.mark.ds_client @pytest.mark.asyncio async def test_actor_cookie(ds_client): """A valid actor cookie sets request.scope['actor']""" @@ -34,7 +32,6 @@ async def test_actor_cookie(ds_client): assert ds_client.ds._last_request.scope["actor"] == {"id": "test"} -@pytest.mark.ds_client @pytest.mark.asyncio async def test_actor_cookie_invalid(ds_client): cookie = ds_client.actor_cookie({"id": "test"}) @@ -47,7 +44,6 @@ async def test_actor_cookie_invalid(ds_client): assert ds_client.ds._last_request.scope["actor"] is None -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "offset,expected", @@ -97,7 +93,6 @@ def test_logout(app_client): assert [["You are now logged out", 2]] == messages -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize("path", ["/", "/fixtures", "/fixtures/facetable"]) async def test_logout_button_in_navigation(ds_client, path): @@ -113,7 +108,6 @@ async def test_logout_button_in_navigation(ds_client, path): assert fragment not in anon_response.text -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize("path", ["/", "/fixtures", "/fixtures/facetable"]) async def test_no_logout_button_in_navigation_if_no_ds_actor_cookie(ds_client, path): @@ -212,7 +206,6 @@ def test_auth_create_token( assert response3.json["actor"]["id"] == "test" -@pytest.mark.ds_client @pytest.mark.asyncio async def test_auth_create_token_not_allowed_for_tokens(ds_client): ds_tok = ds_client.ds.sign({"a": "test", "token": "dstok"}, "token") @@ -223,7 +216,6 @@ async def test_auth_create_token_not_allowed_for_tokens(ds_client): assert response.status_code == 403 -@pytest.mark.ds_client @pytest.mark.asyncio async def test_auth_create_token_not_allowed_if_allow_signed_tokens_off(ds_client): ds_client.ds._settings["allow_signed_tokens"] = False @@ -237,7 +229,6 @@ async def test_auth_create_token_not_allowed_if_allow_signed_tokens_off(ds_clien ds_client.ds._settings["allow_signed_tokens"] = True -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "scenario,should_work", diff --git a/tests/test_canned_queries.py b/tests/test_canned_queries.py index 9e85e0d7..fc70020a 100644 --- a/tests/test_canned_queries.py +++ b/tests/test_canned_queries.py @@ -73,7 +73,6 @@ def canned_write_immutable_client(): yield client -@pytest.mark.ds_client @pytest.mark.asyncio async def test_canned_query_with_named_parameter(ds_client): response = await ds_client.get("/fixtures/neighborhood_search.json?text=town") diff --git a/tests/test_csv.py b/tests/test_csv.py index 63184126..c43e528b 100644 --- a/tests/test_csv.py +++ b/tests/test_csv.py @@ -54,7 +54,6 @@ pk,foreign_key_with_label,foreign_key_with_label_label,foreign_key_with_blank_la ) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_csv(ds_client): response = await ds_client.get("/fixtures/simple_primary_key.csv?_oh=1") @@ -70,7 +69,6 @@ def test_table_csv_cors_headers(app_client_with_cors): assert response.headers["Access-Control-Allow-Origin"] == "*" -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_csv_no_header(ds_client): response = await ds_client.get("/fixtures/simple_primary_key.csv?_header=off") @@ -80,7 +78,6 @@ async def test_table_csv_no_header(ds_client): assert response.text == EXPECTED_TABLE_CSV.split("\r\n", 1)[1] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_csv_with_labels(ds_client): response = await ds_client.get("/fixtures/facetable.csv?_labels=1") @@ -89,7 +86,6 @@ async def test_table_csv_with_labels(ds_client): assert response.text == EXPECTED_TABLE_WITH_LABELS_CSV -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_csv_with_nullable_labels(ds_client): response = await ds_client.get("/fixtures/foreign_key_references.csv?_labels=1") @@ -98,7 +94,6 @@ async def test_table_csv_with_nullable_labels(ds_client): assert response.text == EXPECTED_TABLE_WITH_NULLABLE_LABELS_CSV -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_csv_blob_columns(ds_client): response = await ds_client.get("/fixtures/binary_data.csv") @@ -112,7 +107,6 @@ async def test_table_csv_blob_columns(ds_client): ) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_custom_sql_csv_blob_columns(ds_client): response = await ds_client.get( @@ -128,7 +122,6 @@ async def test_custom_sql_csv_blob_columns(ds_client): ) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_custom_sql_csv(ds_client): response = await ds_client.get( @@ -139,7 +132,6 @@ async def test_custom_sql_csv(ds_client): assert response.text == EXPECTED_CUSTOM_CSV -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_csv_download(ds_client): response = await ds_client.get("/fixtures/simple_primary_key.csv?_dl=1") @@ -151,7 +143,6 @@ async def test_table_csv_download(ds_client): ) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_csv_with_non_ascii_characters(ds_client): response = await ds_client.get( @@ -176,7 +167,6 @@ def test_max_csv_mb(app_client_csv_max_mb_one): assert last_line.startswith(b"CSV contains more than") -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_csv_stream(ds_client): # Without _stream should return header + 100 rows: diff --git a/tests/test_facets.py b/tests/test_facets.py index cecaa305..1921cba7 100644 --- a/tests/test_facets.py +++ b/tests/test_facets.py @@ -8,7 +8,6 @@ import json import pytest -@pytest.mark.ds_client @pytest.mark.asyncio async def test_column_facet_suggest(ds_client): facet = ColumnFacet( @@ -37,7 +36,6 @@ async def test_column_facet_suggest(ds_client): ] == suggestions -@pytest.mark.ds_client @pytest.mark.asyncio async def test_column_facet_suggest_skip_if_already_selected(ds_client): facet = ColumnFacet( @@ -76,7 +74,6 @@ async def test_column_facet_suggest_skip_if_already_selected(ds_client): ] == suggestions -@pytest.mark.ds_client @pytest.mark.asyncio async def test_column_facet_suggest_skip_if_enabled_by_metadata(ds_client): facet = ColumnFacet( @@ -99,7 +96,6 @@ async def test_column_facet_suggest_skip_if_enabled_by_metadata(ds_client): ] == suggestions -@pytest.mark.ds_client @pytest.mark.asyncio async def test_column_facet_results(ds_client): facet = ColumnFacet( @@ -152,7 +148,6 @@ async def test_column_facet_results(ds_client): ] == buckets -@pytest.mark.ds_client @pytest.mark.asyncio async def test_column_facet_results_column_starts_with_underscore(ds_client): facet = ColumnFacet( @@ -275,7 +270,6 @@ async def test_column_facet_results_column_starts_with_underscore(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_column_facet_from_metadata_cannot_be_hidden(ds_client): facet = ColumnFacet( @@ -329,7 +323,6 @@ async def test_column_facet_from_metadata_cannot_be_hidden(ds_client): ] == buckets -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.skipif(not detect_json1(), reason="Requires the SQLite json1 module") async def test_array_facet_suggest(ds_client): @@ -350,7 +343,6 @@ async def test_array_facet_suggest(ds_client): ] == suggestions -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.skipif(not detect_json1(), reason="Requires the SQLite json1 module") async def test_array_facet_suggest_not_if_all_empty_arrays(ds_client): @@ -365,7 +357,6 @@ async def test_array_facet_suggest_not_if_all_empty_arrays(ds_client): assert [] == suggestions -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.skipif(not detect_json1(), reason="Requires the SQLite json1 module") async def test_array_facet_results(ds_client): @@ -412,7 +403,6 @@ async def test_array_facet_results(ds_client): ] == buckets -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.skipif(not detect_json1(), reason="Requires the SQLite json1 module") async def test_array_facet_handle_duplicate_tags(): @@ -468,7 +458,6 @@ async def test_array_facet_handle_duplicate_tags(): } -@pytest.mark.ds_client @pytest.mark.asyncio async def test_date_facet_results(ds_client): facet = DateFacet( @@ -634,8 +623,6 @@ def test_other_types_of_facet_in_metadata(): assert fragment in response.text -@pytest.mark.ds_client -@pytest.mark.ds_client @pytest.mark.asyncio async def test_conflicting_facet_names_json(ds_client): response = await ds_client.get( diff --git a/tests/test_filters.py b/tests/test_filters.py index b85e97b7..01b0ec6f 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -77,7 +77,6 @@ def test_build_where(args, expected_where, expected_params): assert {f"p{i}": param for i, param in enumerate(expected_params)} == actual_params -@pytest.mark.ds_client @pytest.mark.asyncio async def test_through_filters_from_request(ds_client): request = Request.fake( @@ -101,7 +100,6 @@ async def test_through_filters_from_request(ds_client): assert filter_args.extra_context == {} -@pytest.mark.ds_client @pytest.mark.asyncio async def test_through_filters_from_request(ds_client): request = Request.fake( @@ -125,7 +123,6 @@ async def test_through_filters_from_request(ds_client): assert filter_args.extra_context == {} -@pytest.mark.ds_client @pytest.mark.asyncio async def test_where_filters_from_request(ds_client): await ds_client.ds.invoke_startup() @@ -145,7 +142,6 @@ async def test_where_filters_from_request(ds_client): } -@pytest.mark.ds_client @pytest.mark.asyncio async def test_search_filters_from_request(ds_client): request = Request.fake("/?_search=bobcat") diff --git a/tests/test_html.py b/tests/test_html.py index e93fb6c2..eadbd720 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -48,14 +48,12 @@ def test_homepage(app_client_two_attached_databases): ] == table_links -@pytest.mark.ds_client @pytest.mark.asyncio async def test_http_head(ds_client): response = await ds_client.head("/") assert response.status_code == 200 -@pytest.mark.ds_client @pytest.mark.asyncio async def test_homepage_options(ds_client): response = await ds_client.options("/") @@ -63,7 +61,6 @@ async def test_homepage_options(ds_client): assert response.text == "ok" -@pytest.mark.ds_client @pytest.mark.asyncio async def test_favicon(ds_client): response = await ds_client.get("/favicon.ico") @@ -73,7 +70,6 @@ async def test_favicon(ds_client): assert response.headers["content-type"] == "image/png" -@pytest.mark.ds_client @pytest.mark.asyncio async def test_static(ds_client): response = await ds_client.get("/-/static/app2.css") @@ -108,7 +104,6 @@ def test_not_allowed_methods(): assert response.status_code == 405 -@pytest.mark.ds_client @pytest.mark.asyncio async def test_database_page(ds_client): response = await ds_client.get("/fixtures") @@ -155,7 +150,6 @@ async def test_database_page(ds_client): ) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_invalid_custom_sql(ds_client): response = await ds_client.get("/fixtures?sql=.schema") @@ -163,7 +157,6 @@ async def test_invalid_custom_sql(ds_client): assert "Statement must be a SELECT" in response.text -@pytest.mark.ds_client @pytest.mark.asyncio async def test_disallowed_custom_sql_pragma(ds_client): response = await ds_client.get( @@ -223,7 +216,6 @@ def test_query_page_truncates(): ] -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected_classes", @@ -256,7 +248,6 @@ async def test_css_classes_on_body(ds_client, path, expected_classes): assert classes == expected_classes -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected_considered", @@ -283,7 +274,6 @@ async def test_templates_considered(ds_client, path, expected_considered): assert f"" in response.text -@pytest.mark.ds_client @pytest.mark.asyncio async def test_row_json_export_link(ds_client): response = await ds_client.get("/fixtures/simple_primary_key/1") @@ -291,7 +281,6 @@ async def test_row_json_export_link(ds_client): assert 'json' in response.text -@pytest.mark.ds_client @pytest.mark.asyncio async def test_query_json_csv_export_links(ds_client): response = await ds_client.get("/fixtures?sql=select+1") @@ -300,7 +289,6 @@ async def test_query_json_csv_export_links(ds_client): assert 'CSV' in response.text -@pytest.mark.ds_client @pytest.mark.asyncio async def test_row_html_simple_primary_key(ds_client): response = await ds_client.get("/fixtures/simple_primary_key/1") @@ -315,7 +303,6 @@ async def test_row_html_simple_primary_key(ds_client): ] == [[str(td) for td in tr.select("td")] for tr in table.select("tbody tr")] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_row_html_no_primary_key(ds_client): response = await ds_client.get("/fixtures/no_primary_key/1") @@ -338,7 +325,6 @@ async def test_row_html_no_primary_key(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected_text,expected_link", @@ -370,7 +356,6 @@ async def test_row_links_from_other_tables( assert link == expected_link -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected", @@ -409,7 +394,6 @@ async def test_row_html_compound_primary_key(ds_client, path, expected): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_index_metadata(ds_client): response = await ds_client.get("/") @@ -423,7 +407,6 @@ async def test_index_metadata(ds_client): assert_footer_links(soup) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_database_metadata(ds_client): response = await ds_client.get("/fixtures") @@ -439,7 +422,6 @@ async def test_database_metadata(ds_client): assert_footer_links(soup) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_database_metadata_with_custom_sql(ds_client): response = await ds_client.get("/fixtures?sql=select+*+from+simple_primary_key") @@ -523,7 +505,6 @@ def test_allow_sql_off(): assert b"View and edit SQL" not in response.content -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize("path", ["/404", "/fixtures/404"]) async def test_404(ds_client, path): @@ -535,7 +516,6 @@ async def test_404(ds_client, path): ) -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected_redirect", @@ -547,7 +527,6 @@ async def test_404_trailing_slash_redirect(ds_client, path, expected_redirect): assert response.headers["Location"] == expected_redirect -@pytest.mark.ds_client @pytest.mark.asyncio async def test_404_content_type(ds_client): response = await ds_client.get("/404") @@ -555,7 +534,6 @@ async def test_404_content_type(ds_client): assert "text/html; charset=utf-8" == response.headers["content-type"] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_canned_query_default_title(ds_client): response = await ds_client.get("/fixtures/magic_parameters") @@ -564,7 +542,6 @@ async def test_canned_query_default_title(ds_client): assert "fixtures: magic_parameters" == soup.find("h1").text -@pytest.mark.ds_client @pytest.mark.asyncio async def test_canned_query_with_custom_metadata(ds_client): response = await ds_client.get("/fixtures/neighborhood_search?text=town") @@ -583,7 +560,6 @@ async def test_canned_query_with_custom_metadata(ds_client): ) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_urlify_custom_queries(ds_client): path = "/fixtures?" + urllib.parse.urlencode( @@ -602,7 +578,6 @@ async def test_urlify_custom_queries(ds_client): ) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_show_hide_sql_query(ds_client): path = "/fixtures?" + urllib.parse.urlencode( @@ -629,7 +604,6 @@ async def test_show_hide_sql_query(ds_client): ] == [(hidden["name"], hidden["value"]) for hidden in hiddens] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_canned_query_with_hide_has_no_hidden_sql(ds_client): # For a canned query the show/hide should NOT have a hidden SQL field @@ -691,7 +665,6 @@ def test_canned_query_show_hide_metadata_option( assert '{") -@pytest.mark.ds_client @pytest.mark.asyncio async def test_config_template_debug_off(ds_client): response = await ds_client.get("/fixtures/facetable?_context=1") @@ -885,7 +852,6 @@ def test_base_url_affects_metadata_extra_css_urls(app_client_base_url_prefix): assert '' in html -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected", @@ -932,7 +898,6 @@ def test_edit_sql_link_not_shown_if_user_lacks_permission(permission_allowed): assert "Edit SQL" not in response.text -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "actor_id,should_have_links,should_not_have_links", @@ -972,7 +937,6 @@ async def test_navigation_menu_links( ), f"{link} found but should not have been in nav menu" -@pytest.mark.ds_client @pytest.mark.asyncio async def test_trace_correctly_escaped(ds_client): response = await ds_client.get("/fixtures?sql=select+'

Hello'&_trace=1") @@ -980,7 +944,6 @@ async def test_trace_correctly_escaped(ds_client): assert "select '<h1>Hello" in response.text -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected", @@ -1035,7 +998,6 @@ async def test_alternate_url_json(ds_client, path, expected): ) -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path", @@ -1049,7 +1011,6 @@ async def test_no_alternate_url_json(ds_client, path): ) -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected", @@ -1072,7 +1033,6 @@ async def test_redirect_percent_encoding_to_tilde_encoding(ds_client, path, expe assert response.headers["location"] == expected -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,metadata,expected_links", diff --git a/tests/test_internal_db.py b/tests/test_internal_db.py index 569b9c5e..351105ef 100644 --- a/tests/test_internal_db.py +++ b/tests/test_internal_db.py @@ -1,7 +1,6 @@ import pytest -@pytest.mark.ds_client @pytest.mark.asyncio async def test_internal_only_available_to_root(ds_client): cookie = ds_client.actor_cookie({"id": "root"}) @@ -11,7 +10,6 @@ async def test_internal_only_available_to_root(ds_client): ).status_code == 200 -@pytest.mark.ds_client @pytest.mark.asyncio async def test_internal_databases(ds_client): cookie = ds_client.actor_cookie({"id": "root"}) @@ -25,7 +23,6 @@ async def test_internal_databases(ds_client): assert databases[1]["database_name"] == "fixtures" -@pytest.mark.ds_client @pytest.mark.asyncio async def test_internal_tables(ds_client): cookie = ds_client.actor_cookie({"id": "root"}) @@ -39,7 +36,6 @@ async def test_internal_tables(ds_client): assert set(table.keys()) == {"rootpage", "table_name", "database_name", "sql"} -@pytest.mark.ds_client @pytest.mark.asyncio async def test_internal_indexes(ds_client): cookie = ds_client.actor_cookie({"id": "root"}) @@ -61,7 +57,6 @@ async def test_internal_indexes(ds_client): } -@pytest.mark.ds_client @pytest.mark.asyncio async def test_internal_foreign_keys(ds_client): cookie = ds_client.actor_cookie({"id": "root"}) diff --git a/tests/test_messages.py b/tests/test_messages.py index 8a3a3dfd..8417b9ae 100644 --- a/tests/test_messages.py +++ b/tests/test_messages.py @@ -2,7 +2,6 @@ from .utils import cookie_was_deleted import pytest -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "qs,expected", @@ -19,7 +18,6 @@ async def test_add_message_sets_cookie(ds_client, qs, expected): assert expected == decoded -@pytest.mark.ds_client @pytest.mark.asyncio async def test_messages_are_displayed_and_cleared(ds_client): # First set the message cookie diff --git a/tests/test_permissions.py b/tests/test_permissions.py index 493cfbc0..caad588c 100644 --- a/tests/test_permissions.py +++ b/tests/test_permissions.py @@ -362,7 +362,6 @@ def test_permissions_checked(app_client, path, permissions): assert_permissions_checked(app_client.ds, permissions) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_permissions_debug(ds_client): ds_client.ds._permission_checks.clear() @@ -395,7 +394,6 @@ async def test_permissions_debug(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "actor,allow,expected_fragment", diff --git a/tests/test_plugins.py b/tests/test_plugins.py index 9fbc06a6..d62e6810 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -42,7 +42,6 @@ def test_plugin_hooks_have_tests(plugin_hook): assert ok, f"Plugin hook is missing tests: {plugin_hook}" -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_plugins_dir_plugin_prepare_connection(ds_client): response = await ds_client.get( @@ -51,7 +50,6 @@ async def test_hook_plugins_dir_plugin_prepare_connection(ds_client): assert pytest.approx(328.0839) == response.json()["rows"][0][0] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_plugin_prepare_connection_arguments(ds_client): response = await ds_client.get( @@ -62,7 +60,6 @@ async def test_hook_plugin_prepare_connection_arguments(ds_client): ] == response.json() -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected_decoded_object", @@ -127,7 +124,6 @@ async def test_hook_extra_css_urls(ds_client, path, expected_decoded_object): ) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_extra_js_urls(ds_client): response = await ds_client.get("/") @@ -147,7 +143,6 @@ async def test_hook_extra_js_urls(ds_client): assert any(s == attrs for s in script_attrs), "Expected: {}".format(attrs) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_plugins_with_duplicate_js_urls(ds_client): # If two plugins both require jQuery, jQuery should be loaded only once @@ -175,7 +170,6 @@ async def test_plugins_with_duplicate_js_urls(ds_client): ) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_render_cell_link_from_json(ds_client): sql = """ @@ -191,7 +185,6 @@ async def test_hook_render_cell_link_from_json(ds_client): assert a.text == "Example" -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_render_cell_demo(ds_client): response = await ds_client.get("/fixtures/simple_primary_key?id=4") @@ -206,7 +199,6 @@ async def test_hook_render_cell_demo(ds_client): } -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path", ("/fixtures?sql=select+'RENDER_CELL_ASYNC'", "/fixtures/simple_primary_key") @@ -216,7 +208,6 @@ async def test_hook_render_cell_async(ds_client, path): assert b"RENDER_CELL_ASYNC_RESULT" in response.content -@pytest.mark.ds_client @pytest.mark.asyncio async def test_plugin_config(ds_client): assert {"depth": "table"} == ds_client.ds.plugin_config( @@ -235,7 +226,6 @@ async def test_plugin_config(ds_client): assert None is ds_client.ds.plugin_config("unknown-plugin") -@pytest.mark.ds_client @pytest.mark.asyncio async def test_plugin_config_env(ds_client): os.environ["FOO_ENV"] = "FROM_ENVIRONMENT" @@ -246,7 +236,6 @@ async def test_plugin_config_env(ds_client): del os.environ["FOO_ENV"] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_plugin_config_env_from_list(ds_client): os.environ["FOO_ENV"] = "FROM_ENVIRONMENT" @@ -261,7 +250,6 @@ async def test_plugin_config_env_from_list(ds_client): del os.environ["FOO_ENV"] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_plugin_config_file(ds_client): with open(TEMP_PLUGIN_SECRET_FILE, "w") as fp: @@ -334,7 +322,6 @@ def test_hook_extra_body_script(app_client, path, expected_extra_body_script): assert expected_extra_body_script == actual_data -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_asgi_wrapper(ds_client): response = await ds_client.get("/fixtures") @@ -446,7 +433,6 @@ def test_view_names(view_names_client, path, view_name): assert f"view_name:{view_name}" == response.text -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_register_output_renderer_no_parameters(ds_client): response = await ds_client.get("/fixtures/facetable.testnone") @@ -454,7 +440,6 @@ async def test_hook_register_output_renderer_no_parameters(ds_client): assert b"Hello" == response.content -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_register_output_renderer_all_parameters(ds_client): response = await ds_client.get("/fixtures/facetable.testall") @@ -507,7 +492,6 @@ async def test_hook_register_output_renderer_all_parameters(ds_client): assert query_response.json()["query_name"] == "pragma_cache_size" -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_register_output_renderer_custom_status_code(ds_client): response = await ds_client.get( @@ -516,7 +500,6 @@ async def test_hook_register_output_renderer_custom_status_code(ds_client): assert response.status_code == 202 -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_register_output_renderer_custom_content_type(ds_client): response = await ds_client.get( @@ -525,7 +508,6 @@ async def test_hook_register_output_renderer_custom_content_type(ds_client): assert "text/blah" == response.headers["content-type"] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_register_output_renderer_custom_headers(ds_client): response = await ds_client.get( @@ -535,7 +517,6 @@ async def test_hook_register_output_renderer_custom_headers(ds_client): assert "2" == response.headers["x-gosh"] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_register_output_renderer_returning_response(ds_client): response = await ds_client.get("/fixtures/facetable.testresponse") @@ -543,7 +524,6 @@ async def test_hook_register_output_renderer_returning_response(ds_client): assert response.json() == {"this_is": "json"} -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_register_output_renderer_returning_broken_value(ds_client): response = await ds_client.get("/fixtures/facetable.testresponse?_broken=1") @@ -551,7 +531,6 @@ async def test_hook_register_output_renderer_returning_broken_value(ds_client): assert "this should break should be dict or Response" in response.text -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_register_output_renderer_can_render(ds_client): response = await ds_client.get("/fixtures/facetable?_no_can_render=1") @@ -589,7 +568,6 @@ async def test_hook_register_output_renderer_can_render(ds_client): }.items() <= ds_client.ds._can_render_saw.items() -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_prepare_jinja2_environment(ds_client): ds_client.ds._HELLO = "HI" @@ -611,7 +589,6 @@ def test_hook_publish_subcommand(): assert ["cloudrun", "heroku"] == cli.publish.list_commands({}) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_register_facet_classes(ds_client): response = await ds_client.get( @@ -653,7 +630,6 @@ async def test_hook_register_facet_classes(ds_client): ] == response.json()["suggested_facets"] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_actor_from_request(ds_client): await ds_client.get("/") @@ -664,7 +640,6 @@ async def test_hook_actor_from_request(ds_client): assert ds_client.ds._last_request.scope["actor"] == {"id": "bot"} -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_actor_from_request_async(ds_client): await ds_client.get("/") @@ -675,7 +650,6 @@ async def test_hook_actor_from_request_async(ds_client): assert ds_client.ds._last_request.scope["actor"] == {"id": "bot2", "1+1": 2} -@pytest.mark.ds_client @pytest.mark.asyncio async def test_existing_scope_actor_respected(ds_client): await ds_client.get("/?_actor_in_scope=1") @@ -718,7 +692,6 @@ async def test_hook_permission_allowed(action, expected): pm.unregister(name="undo_register_extras") -@pytest.mark.ds_client @pytest.mark.asyncio async def test_actor_json(ds_client): assert (await ds_client.get("/-/actor.json")).json() == {"actor": None} @@ -727,7 +700,6 @@ async def test_actor_json(ds_client): } -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,body", @@ -799,7 +771,6 @@ def test_hook_register_routes_csrftoken(restore_working_directory, tmpdir_factor assert f"CSRFTOKEN: {expected_token}" == response.text -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_register_routes_asgi(ds_client): response = await ds_client.get("/three/") @@ -807,7 +778,6 @@ async def test_hook_register_routes_asgi(ds_client): assert "1" == response.headers["x-three"] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_register_routes_add_message(ds_client): response = await ds_client.get("/add-message/") @@ -827,7 +797,6 @@ def test_hook_register_routes_render_message(restore_working_directory, tmpdir_f assert "Hello from messages" in response2.text -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_startup(ds_client): await ds_client.ds.invoke_startup() @@ -835,7 +804,6 @@ async def test_hook_startup(ds_client): assert 2 == ds_client.ds._startup_hook_calculation -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_canned_queries(ds_client): queries = (await ds_client.get("/fixtures.json")).json()["queries"] @@ -852,21 +820,18 @@ async def test_hook_canned_queries(ds_client): } == queries_by_name["from_hook"] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_canned_queries_non_async(ds_client): response = await ds_client.get("/fixtures/from_hook.json?_shape=array") assert [{"1": 1, "actor_id": "null"}] == response.json() -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_canned_queries_async(ds_client): response = await ds_client.get("/fixtures/from_async_hook.json?_shape=array") assert [{"2": 2}] == response.json() -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_canned_queries_actor(ds_client): assert ( @@ -923,7 +888,6 @@ def test_hook_forbidden(restore_working_directory): ) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_handle_exception(ds_client): await ds_client.get("/trigger-error?x=123") @@ -933,7 +897,6 @@ async def test_hook_handle_exception(ds_client): assert isinstance(exception, ZeroDivisionError) -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize("param", ("_custom_error", "_custom_error_async")) async def test_hook_handle_exception_custom_response(ds_client, param): @@ -941,7 +904,6 @@ async def test_hook_handle_exception_custom_response(ds_client, param): assert response.text == param -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_menu_links(ds_client): def get_menu_links(html): @@ -960,7 +922,6 @@ async def test_hook_menu_links(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize("table_or_view", ["facetable", "simple_view"]) async def test_hook_table_actions(ds_client, table_or_view): @@ -984,7 +945,6 @@ async def test_hook_table_actions(ds_client, table_or_view): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_database_actions(ds_client): def get_table_actions_links(html): @@ -1028,7 +988,6 @@ def test_hook_skip_csrf(app_client): assert second_missing_csrf_response.status_code == 403 -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_get_metadata(ds_client): ds_client.ds._metadata_local = { @@ -1110,7 +1069,6 @@ def test_hook_register_commands(): importlib.reload(cli) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_hook_filters_from_request(ds_client): class ReturnNothingPlugin: diff --git a/tests/test_table_api.py b/tests/test_table_api.py index 46b64a54..4562c931 100644 --- a/tests/test_table_api.py +++ b/tests/test_table_api.py @@ -13,7 +13,6 @@ import pytest import urllib -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_json(ds_client): response = await ds_client.get("/fixtures/simple_primary_key.json?_shape=objects") @@ -33,7 +32,6 @@ async def test_table_json(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_not_exists_json(ds_client): assert (await ds_client.get("/fixtures/blah.json")).json() == { @@ -44,7 +42,6 @@ async def test_table_not_exists_json(ds_client): } -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_shape_arrays(ds_client): response = await ds_client.get("/fixtures/simple_primary_key.json?_shape=arrays") @@ -57,7 +54,6 @@ async def test_table_shape_arrays(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_shape_arrayfirst(ds_client): response = await ds_client.get( @@ -78,7 +74,6 @@ async def test_table_shape_arrayfirst(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_shape_objects(ds_client): response = await ds_client.get("/fixtures/simple_primary_key.json?_shape=objects") @@ -91,7 +86,6 @@ async def test_table_shape_objects(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_shape_array(ds_client): response = await ds_client.get("/fixtures/simple_primary_key.json?_shape=array") @@ -104,7 +98,6 @@ async def test_table_shape_array(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_shape_array_nl(ds_client): response = await ds_client.get( @@ -121,7 +114,6 @@ async def test_table_shape_array_nl(ds_client): ] == results -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_shape_invalid(ds_client): response = await ds_client.get("/fixtures/simple_primary_key.json?_shape=invalid") @@ -133,7 +125,6 @@ async def test_table_shape_invalid(ds_client): } -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_shape_object(ds_client): response = await ds_client.get("/fixtures/simple_primary_key.json?_shape=object") @@ -146,7 +137,6 @@ async def test_table_shape_object(ds_client): } -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_shape_object_compound_primary_key(ds_client): response = await ds_client.get("/fixtures/compound_primary_key.json?_shape=object") @@ -156,7 +146,6 @@ async def test_table_shape_object_compound_primary_key(ds_client): } -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_with_slashes_in_name(ds_client): response = await ds_client.get( @@ -167,7 +156,6 @@ async def test_table_with_slashes_in_name(ds_client): assert data["rows"] == [{"pk": "3", "content": "hey"}] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_with_reserved_word_name(ds_client): response = await ds_client.get("/fixtures/select.json?_shape=objects") @@ -184,7 +172,6 @@ async def test_table_with_reserved_word_name(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected_rows,expected_pages", @@ -225,7 +212,6 @@ async def test_paginate_tables_and_views( assert expected_pages == count -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected_error", @@ -241,7 +227,6 @@ async def test_validate_page_size(ds_client, path, expected_error): assert response.status_code == 400 -@pytest.mark.ds_client @pytest.mark.asyncio async def test_page_size_zero(ds_client): """For _size=0 we return the counts, empty rows and no continuation token""" @@ -253,7 +238,6 @@ async def test_page_size_zero(ds_client): assert None is response.json()["next_url"] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_paginate_compound_keys(ds_client): fetched = [] @@ -275,7 +259,6 @@ async def test_paginate_compound_keys(ds_client): assert expected == contents -@pytest.mark.ds_client @pytest.mark.asyncio async def test_paginate_compound_keys_with_extra_filters(ds_client): fetched = [] @@ -296,7 +279,6 @@ async def test_paginate_compound_keys_with_extra_filters(ds_client): assert expected == [f["content"] for f in fetched] -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "query_string,sort_key,human_description_en", @@ -351,7 +333,6 @@ async def test_sortable(ds_client, query_string, sort_key, human_description_en) assert [r["content"] for r in expected] == [r["content"] for r in fetched] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_sortable_and_filtered(ds_client): path = ( @@ -370,7 +351,6 @@ async def test_sortable_and_filtered(ds_client): assert [r["content"] for r in expected] == [r["content"] for r in fetched] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_sortable_argument_errors(ds_client): response = await ds_client.get("/fixtures/sortable.json?_sort=badcolumn") @@ -385,7 +365,6 @@ async def test_sortable_argument_errors(ds_client): ) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_sortable_columns_metadata(ds_client): response = await ds_client.get("/fixtures/sortable.json?_sort=content") @@ -396,7 +375,6 @@ async def test_sortable_columns_metadata(ds_client): assert f"Cannot sort table by {column}" == response.json()["error"] -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected_rows", @@ -492,7 +470,6 @@ def test_searchmode(table_metadata, querystring, expected_rows): assert expected_rows == response.json["rows"] -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected_rows", @@ -520,7 +497,6 @@ async def test_searchable_views(ds_client, path, expected_rows): assert expected_rows == response.json()["rows"] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_searchable_invalid_column(ds_client): response = await ds_client.get("/fixtures/searchable.json?_search_invalid=x") @@ -533,7 +509,6 @@ async def test_searchable_invalid_column(ds_client): } -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected_rows", @@ -564,7 +539,6 @@ async def test_table_filter_queries(ds_client, path, expected_rows): assert expected_rows == response.json()["rows"] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_filter_queries_multiple_of_same_type(ds_client): response = await ds_client.get( @@ -578,7 +552,6 @@ async def test_table_filter_queries_multiple_of_same_type(ds_client): @pytest.mark.skipif(not detect_json1(), reason="Requires the SQLite json1 module") -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_filter_json_arraycontains(ds_client): response = await ds_client.get("/fixtures/facetable.json?tags__arraycontains=tag1") @@ -613,7 +586,6 @@ async def test_table_filter_json_arraycontains(ds_client): @pytest.mark.skipif(not detect_json1(), reason="Requires the SQLite json1 module") -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_filter_json_arraynotcontains(ds_client): response = await ds_client.get( @@ -636,7 +608,6 @@ async def test_table_filter_json_arraynotcontains(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_filter_extra_where(ds_client): response = await ds_client.get( @@ -659,7 +630,6 @@ async def test_table_filter_extra_where(ds_client): ] == response.json()["rows"] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_filter_extra_where_invalid(ds_client): response = await ds_client.get( @@ -678,7 +648,6 @@ def test_table_filter_extra_where_disabled_if_no_sql_allowed(): assert "_where= is not allowed" == response.json["error"] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_through(ds_client): # Just the museums: @@ -710,7 +679,6 @@ async def test_table_through(ds_client): ) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_max_returned_rows(ds_client): response = await ds_client.get( @@ -722,7 +690,6 @@ async def test_max_returned_rows(ds_client): assert 100 == len(data["rows"]) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_view(ds_client): response = await ds_client.get("/fixtures/simple_view.json?_shape=objects") @@ -737,7 +704,6 @@ async def test_view(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_unit_filters(ds_client): response = await ds_client.get( @@ -768,7 +734,6 @@ def test_page_size_matching_max_returned_rows( assert len(fetched) == 201 -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected_facet_results", @@ -946,7 +911,6 @@ async def test_facets(ds_client, path, expected_facet_results): assert expected_facet_results == facet_results -@pytest.mark.ds_client @pytest.mark.asyncio async def test_suggested_facets(ds_client): suggestions = [ @@ -987,7 +951,6 @@ def test_suggest_facets_off(): assert [] == client.get("/fixtures/facetable.json").json["suggested_facets"] -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize("nofacet", (True, False)) async def test_nofacet(ds_client, nofacet): @@ -1003,7 +966,6 @@ async def test_nofacet(ds_client, nofacet): assert response.json()["facet_results"] != {} -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize("nosuggest", (True, False)) async def test_nosuggest(ds_client, nosuggest): @@ -1020,7 +982,6 @@ async def test_nosuggest(ds_client, nosuggest): assert response.json()["facet_results"] != {} -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize("nocount,expected_count", ((True, None), (False, 15))) async def test_nocount(ds_client, nocount, expected_count): @@ -1038,7 +999,6 @@ def test_nocount_nofacet_if_shape_is_object(app_client_with_trace): assert "count(*)" not in response.text -@pytest.mark.ds_client @pytest.mark.asyncio async def test_expand_labels(ds_client): response = await ds_client.get( @@ -1075,7 +1035,6 @@ async def test_expand_labels(ds_client): } -@pytest.mark.ds_client @pytest.mark.asyncio async def test_expand_label(ds_client): response = await ds_client.get( @@ -1094,7 +1053,6 @@ async def test_expand_label(ds_client): } -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected_cache_control", @@ -1110,7 +1068,6 @@ async def test_ttl_parameter(ds_client, path, expected_cache_control): assert response.headers["Cache-Control"] == expected_cache_control -@pytest.mark.ds_client @pytest.mark.asyncio async def test_infinity_returned_as_null(ds_client): response = await ds_client.get("/fixtures/infinity.json?_shape=array") @@ -1121,7 +1078,6 @@ async def test_infinity_returned_as_null(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_infinity_returned_as_invalid_json_if_requested(ds_client): response = await ds_client.get( @@ -1134,7 +1090,6 @@ async def test_infinity_returned_as_invalid_json_if_requested(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_custom_query_with_unicode_characters(ds_client): # /fixtures/𝐜𝐢𝐭𝐢𝐞𝐬.json @@ -1144,7 +1099,6 @@ async def test_custom_query_with_unicode_characters(ds_client): assert response.json() == [{"id": 1, "name": "San Francisco"}] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_null_and_compound_foreign_keys_are_not_expanded(ds_client): response = await ds_client.get( @@ -1170,7 +1124,6 @@ async def test_null_and_compound_foreign_keys_are_not_expanded(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected_json,expected_text", @@ -1203,7 +1156,6 @@ async def test_binary_data_in_json(ds_client, path, expected_json, expected_text assert response.text == expected_text -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "qs", @@ -1264,7 +1216,6 @@ def test_generated_columns_are_visible_in_datasette(): ] -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected_columns", @@ -1327,7 +1278,6 @@ async def test_col_nocol(ds_client, path, expected_columns): assert columns == expected_columns -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected_error", diff --git a/tests/test_table_html.py b/tests/test_table_html.py index c2f512c9..857342c3 100644 --- a/tests/test_table_html.py +++ b/tests/test_table_html.py @@ -10,7 +10,6 @@ import urllib.parse from .utils import assert_footer_links, inner_html -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected_definition_sql", @@ -84,7 +83,6 @@ def test_table_cell_truncation(): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_add_filter_redirects(ds_client): filter_args = urllib.parse.urlencode( @@ -119,7 +117,6 @@ async def test_add_filter_redirects(ds_client): assert response.headers["Location"].endswith("?content__isnull=5") -@pytest.mark.ds_client @pytest.mark.asyncio async def test_existing_filter_redirects(ds_client): filter_args = { @@ -161,7 +158,6 @@ async def test_existing_filter_redirects(ds_client): assert "?" not in response.headers["Location"] -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "qs,expected_hidden", @@ -188,7 +184,6 @@ async def test_reflected_hidden_form_fields(ds_client, qs, expected_hidden): assert hidden_inputs == expected_hidden -@pytest.mark.ds_client @pytest.mark.asyncio async def test_empty_search_parameter_gets_removed(ds_client): path_base = "/fixtures/simple_primary_key" @@ -209,7 +204,6 @@ async def test_empty_search_parameter_gets_removed(ds_client): assert response.headers["Location"].endswith("?name__exact=chidi") -@pytest.mark.ds_client @pytest.mark.asyncio async def test_searchable_view_persists_fts_table(ds_client): # The search form should persist ?_fts_table as a hidden field @@ -223,7 +217,6 @@ async def test_searchable_view_persists_fts_table(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_sort_by_desc_redirects(ds_client): path_base = "/fixtures/sortable" @@ -237,7 +230,6 @@ async def test_sort_by_desc_redirects(ds_client): assert response.headers["Location"].endswith("?_sort_desc=sortable") -@pytest.mark.ds_client @pytest.mark.asyncio async def test_sort_links(ds_client): response = await ds_client.get("/fixtures/sortable?_sort=sortable") @@ -342,7 +334,6 @@ async def test_sort_links(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_facet_display(ds_client): response = await ds_client.get( @@ -425,7 +416,6 @@ async def test_facet_display(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_facets_persist_through_filter_form(ds_client): response = await ds_client.get( @@ -441,7 +431,6 @@ async def test_facets_persist_through_filter_form(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_next_does_not_persist_in_hidden_field(ds_client): response = await ds_client.get("/fixtures/searchable?_size=1&_next=1") @@ -453,7 +442,6 @@ async def test_next_does_not_persist_in_hidden_field(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_html_simple_primary_key(ds_client): response = await ds_client.get("/fixtures/simple_primary_key?_size=3") @@ -483,7 +471,6 @@ async def test_table_html_simple_primary_key(ds_client): ] == [[str(td) for td in tr.select("td")] for tr in table.select("tbody tr")] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_csv_json_export_interface(ds_client): response = await ds_client.get("/fixtures/simple_primary_key?id__gt=2") @@ -525,7 +512,6 @@ async def test_table_csv_json_export_interface(ds_client): ] == inputs -@pytest.mark.ds_client @pytest.mark.asyncio async def test_csv_json_export_links_include_labels_if_foreign_keys(ds_client): response = await ds_client.get("/fixtures/facetable") @@ -547,13 +533,11 @@ async def test_csv_json_export_links_include_labels_if_foreign_keys(ds_client): assert expected == actual -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_not_exists(ds_client): assert "Table not found: blah" in (await ds_client.get("/fixtures/blah")).text -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_html_no_primary_key(ds_client): response = await ds_client.get("/fixtures/no_primary_key") @@ -581,7 +565,6 @@ async def test_table_html_no_primary_key(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_rowid_sortable_no_primary_key(ds_client): response = await ds_client.get("/fixtures/no_primary_key") @@ -592,7 +575,6 @@ async def test_rowid_sortable_no_primary_key(ds_client): assert "rowid\xa0▼" == ths[1].find("a").string.strip() -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_html_compound_primary_key(ds_client): response = await ds_client.get("/fixtures/compound_primary_key") @@ -624,7 +606,6 @@ async def test_table_html_compound_primary_key(ds_client): ] == expected -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_html_foreign_key_links(ds_client): response = await ds_client.get("/fixtures/foreign_key_references") @@ -651,7 +632,6 @@ async def test_table_html_foreign_key_links(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_html_foreign_key_facets(ds_client): response = await ds_client.get( @@ -664,7 +644,6 @@ async def test_table_html_foreign_key_facets(ds_client): ) in response.text -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_html_disable_foreign_key_links_with_labels(ds_client): response = await ds_client.get( @@ -685,7 +664,6 @@ async def test_table_html_disable_foreign_key_links_with_labels(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_html_foreign_key_custom_label_column(ds_client): response = await ds_client.get("/fixtures/custom_foreign_key_label") @@ -702,7 +680,6 @@ async def test_table_html_foreign_key_custom_label_column(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected_column_options", @@ -728,7 +705,6 @@ async def test_table_html_filter_form_column_options( assert expected_column_options == column_options -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_html_filter_form_still_shows_nocol_columns(ds_client): # https://github.com/simonw/datasette/issues/1503 @@ -751,7 +727,6 @@ async def test_table_html_filter_form_still_shows_nocol_columns(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_compound_primary_key_with_foreign_key_references(ds_client): # e.g. a many-to-many table with a compound primary key on the two columns @@ -775,7 +750,6 @@ async def test_compound_primary_key_with_foreign_key_references(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_view_html(ds_client): response = await ds_client.get("/fixtures/simple_view?_size=3") @@ -807,7 +781,6 @@ async def test_view_html(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio async def test_table_metadata(ds_client): response = await ds_client.get("/fixtures/simple_primary_key") @@ -823,7 +796,6 @@ async def test_table_metadata(ds_client): assert_footer_links(soup) -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,has_object,has_stream,has_expand", @@ -850,7 +822,6 @@ async def test_advanced_export_box(ds_client, path, has_object, has_stream, has_ assert "expand labels" in str(div) -@pytest.mark.ds_client @pytest.mark.asyncio async def test_extra_where_clauses(ds_client): response = await ds_client.get( @@ -872,7 +843,6 @@ async def test_extra_where_clauses(ds_client): ] -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected_hidden", @@ -896,7 +866,6 @@ async def test_other_hidden_form_fields(ds_client, path, expected_hidden): assert [(hidden["name"], hidden["value"]) for hidden in hiddens] == expected_hidden -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected_hidden", @@ -916,7 +885,6 @@ async def test_search_and_sort_fields_not_duplicated(ds_client, path, expected_h assert [(hidden["name"], hidden["value"]) for hidden in hiddens] == expected_hidden -@pytest.mark.ds_client @pytest.mark.asyncio async def test_binary_data_display_in_table(ds_client): response = await ds_client.get("/fixtures/binary_data") @@ -957,7 +925,6 @@ def test_custom_table_include(): ) == str(Soup(response.text, "html.parser").select_one("div.custom-table-row")) -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize("json", (True, False)) @pytest.mark.parametrize( @@ -989,7 +956,6 @@ async def test_sort_errors(ds_client, json, params, error): assert error in response.text -@pytest.mark.ds_client @pytest.mark.asyncio async def test_metadata_sort(ds_client): response = await ds_client.get("/fixtures/facet_cities") @@ -1026,7 +992,6 @@ async def test_metadata_sort(ds_client): assert list(reversed(expected)) == rows -@pytest.mark.ds_client @pytest.mark.asyncio async def test_metadata_sort_desc(ds_client): response = await ds_client.get("/fixtures/attraction_characteristic") @@ -1130,7 +1095,6 @@ def test_unavailable_table_does_not_break_sort_relationships(): assert response.status == 200 -@pytest.mark.ds_client @pytest.mark.asyncio async def test_column_metadata(ds_client): response = await ds_client.get("/fixtures/roadside_attractions") @@ -1165,7 +1129,6 @@ def test_facet_total(): assert fragment in response.text -@pytest.mark.ds_client @pytest.mark.asyncio async def test_sort_rowid_with_next(ds_client): # https://github.com/simonw/datasette/issues/1470 @@ -1177,7 +1140,6 @@ def assert_querystring_equal(expected, actual): assert sorted(expected.split("&")) == sorted(actual.split("&")) -@pytest.mark.ds_client @pytest.mark.asyncio @pytest.mark.parametrize( "path,expected",