{"html_url": "https://github.com/simonw/datasette/pull/1960#issuecomment-1356478575", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1960", "id": 1356478575, "node_id": "IC_kwDOBm6k_c5Q2jhv", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-17T21:47:48Z", "updated_at": "2022-12-17T21:47:48Z", "author_association": "OWNER", "body": "Stick a twig in it, this will do for the moment.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1499150951, "label": "Port as many tests as possible to async def tests against ds_client"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/1960#issuecomment-1356476886", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1960", "id": 1356476886, "node_id": "IC_kwDOBm6k_c5Q2jHW", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-17T21:37:05Z", "updated_at": "2022-12-17T21:37:05Z", "author_association": "OWNER", "body": "I think this test may be to blame:\r\n\r\nhttps://github.com/simonw/datasette/blob/5ee954e34b6eb762ccecbdb2be0791d0166fd19c/tests/test_plugins.py#L950-L972\r\n\r\nIt's over-riding `_metadata_local` and then failing to set it back to original in a `finally:` block at the end.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1499150951, "label": "Port as many tests as possible to async def tests against ds_client"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/1960#issuecomment-1356476583", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1960", "id": 1356476583, "node_id": "IC_kwDOBm6k_c5Q2jCn", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-17T21:34:51Z", "updated_at": "2022-12-17T21:34:51Z", "author_association": "OWNER", "body": "These are all the places that tests touch `_metadata_local` at the moment:\r\n```\r\n(venv) root@76a81d2417f5:/tmp/datasette/tests# rg _metadata_local \r\ntest_facets.py\r\n596: ds._metadata_local = {\r\n605: ds._metadata_local[\"databases\"][\"test_facet_size\"][\"tables\"][\"neighbourhoods\"][\r\n\r\ntest_permissions.py\r\n62: padlock_client.ds._metadata_local[\"allow\"] = allow\r\n77: del padlock_client.ds._metadata_local[\"allow\"]\r\n522: cascade_app_client.ds._metadata_local = updated_metadata\r\n533: cascade_app_client.ds._metadata_local = previous_metadata\r\n549: previous_metadata = cascade_app_client.ds._metadata_local\r\n551: cascade_app_client.ds._metadata_local = metadata\r\n566: cascade_app_client.ds._metadata_local = previous_metadata\r\n842: perms_ds._metadata_local = updated_metadata\r\n849: perms_ds._metadata_local = previous_metadata\r\n\r\ntest_html.py\r\n1114: orig = ds_client.ds._metadata_local\r\n1115: ds_client.ds._metadata_local = metadata\r\n1123: ds_client.ds._metadata_local = orig\r\n\r\ntest_plugins.py\r\n1034: ds_client.ds._metadata_local = {\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1499150951, "label": "Port as many tests as possible to async def tests against ds_client"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/1960#issuecomment-1356056018", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1960", "id": 1356056018, "node_id": "IC_kwDOBm6k_c5Q08XS", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-17T05:33:26Z", "updated_at": "2022-12-17T05:33:26Z", "author_association": "OWNER", "body": "I think I've found the problem. The failing test is this one:\r\n\r\n`paginated_view.json-201-9`\r\n\r\nThat's this example:\r\n\r\nhttps://github.com/simonw/datasette/blob/cede1efeedbc3d928397d53d5a1611eecc598fde/tests/test_table_api.py#L179-L180\r\n\r\nWhy is it expected to take 9 pages and not 5, when the definition of that view is this:\r\n\r\n```sql\r\nCREATE VIEW paginated_view AS\r\n SELECT\r\n content,\r\n '- ' || content || ' -' AS content_extra\r\n FROM no_primary_key;\r\n```\r\nBecause `paginated_view` has extra configuration in `metadata.json`:\r\n\r\nhttps://github.com/simonw/datasette/blob/5ee954e34b6eb762ccecbdb2be0791d0166fd19c/tests/fixtures.py#L357\r\n\r\nSo this test is showing that `metadata` can be used to set an alternative page size for a view.\r\n\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1499150951, "label": "Port as many tests as possible to async def tests against ds_client"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/1960#issuecomment-1356038242", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1960", "id": 1356038242, "node_id": "IC_kwDOBm6k_c5Q04Bi", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-17T04:56:22Z", "updated_at": "2022-12-17T04:57:04Z", "author_association": "OWNER", "body": "May have spotted the problem with that `test_paginate_tables_and_views` test:\r\n\r\n```\r\n(Pdb) path, expected_rows, expected_pages\r\n(None, 201, 9)\r\n```\r\n`path` should not be `None` here:\r\n\r\nhttps://github.com/simonw/datasette/blob/cede1efeedbc3d928397d53d5a1611eecc598fde/tests/test_table_api.py#L175-L212\r\n\r\nNo that's not it either - `path` is reassigned on purpose.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1499150951, "label": "Port as many tests as possible to async def tests against ds_client"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/1960#issuecomment-1355823260", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1960", "id": 1355823260, "node_id": "IC_kwDOBm6k_c5Q0Dic", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-16T23:36:07Z", "updated_at": "2022-12-16T23:36:07Z", "author_association": "OWNER", "body": "I ran `pytest --pdb -x` to drop into the debugger on the first failing test.\r\n\r\n```\r\n assert expected_rows == len(fetched)\r\n> assert expected_pages == count\r\nE assert 9 == 5\r\n```\r\nThat's in `test_paginate_tables_and_views()`.\r\n\r\nOn a hunch, I checked the current settings:\r\n\r\n```\r\n(Pdb) ds_client.ds._settings\r\n{'default_page_size': 50, 'max_returned_rows': 100, 'max_insert_rows': 100, 'num_sql_threads': 1, 'sql_time_limit_ms': 200, 'default_facet_size': 30, 'facet_time_limit_ms': 200, 'facet_suggest_time_limit_ms': 50, 'allow_facet': True, 'allow_download': True, 'allow_signed_tokens': True, 'max_signed_tokens_ttl': 0, 'suggest_facets': True, 'default_cache_ttl': 5, 'cache_size_kb': 0, 'allow_csv_stream': True, 'max_csv_mb': 100, 'truncate_cells_html': 2048, 'force_https_urls': False, 'template_debug': False, 'trace_debug': False, 'base_url': '/'}\r\n```\r\nLooks like something changed `default_page_size` to 50 and forgot to change it back!", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1499150951, "label": "Port as many tests as possible to async def tests against ds_client"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/1960#issuecomment-1355685828", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1960", "id": 1355685828, "node_id": "IC_kwDOBm6k_c5Qzh_E", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-16T21:50:01Z", "updated_at": "2022-12-16T21:50:01Z", "author_association": "OWNER", "body": "Looks like that `@pytest.mark.ds_client` mark I've been using isn't necessary - I added that so I could easily run `pytest -m ds_client` to execute all tests that I had ported to the new feature, but actually this achieves the same thing:\r\n\r\n pytest -k ds_client\r\n\r\nSo I'm going to remove the mark.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1499150951, "label": "Port as many tests as possible to async def tests against ds_client"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/1960#issuecomment-1355478743", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1960", "id": 1355478743, "node_id": "IC_kwDOBm6k_c5QyvbX", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-16T19:27:12Z", "updated_at": "2022-12-16T19:27:12Z", "author_association": "OWNER", "body": "Bad news: they're definitely caused by tests that are subtly affected by other tests.\r\n\r\nThis passes without errors:\r\n\r\n pytest -k test_paginate_tables_and_views", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1499150951, "label": "Port as many tests as possible to async def tests against ds_client"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/1960#issuecomment-1355475671", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1960", "id": 1355475671, "node_id": "IC_kwDOBm6k_c5QyurX", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-16T19:26:08Z", "updated_at": "2022-12-16T19:26:08Z", "author_association": "OWNER", "body": "Great news! The test failures I got running on my laptop (with that fresh Ubuntu Docker image) look like they match the failures I saw in CI:\r\n\r\n```\r\n======== short test summary info ========\r\nFAILED tests/test_table_api.py::test_paginate_tables_and_views[/fixtures/paginated_view.json-201-9] - assert 9 == 5\r\nFAILED tests/test_table_api.py::test_sortable_columns_metadata - KeyError: 'error'\r\nFAILED tests/test_table_api.py::test_searchable_views[/fixtures/searchable_view_configured_by_metadata.json?_search=weasel-expected_rows0] - AssertionError: assert [[2, 'terry d...sel', 'puma']] == [[1, 'barry c...sel', 'puma']]\r\nFAILED tests/test_table_api.py::test_unit_filters - KeyError: 'distance'\r\nFAILED tests/test_table_api.py::test_custom_query_with_unicode_characters - AssertionError: assert {'error': 'Ta...'title': None} == [{'id': 1, 'n...n Francisco'}]\r\nFAILED tests/test_table_html.py::test_sort_links - AssertionError: assert [{'a_href': N...', ...}}, ...] == [{'a_href': N...', ...}}, ...]\r\nFAILED tests/test_table_html.py::test_table_html_no_primary_key - AttributeError: 'NoneType' object has no attribute 'strip'\r\nFAILED tests/test_table_html.py::test_table_html_foreign_key_custom_label_column - assert [['