{"html_url": "https://github.com/simonw/datasette/issues/1843#issuecomment-1353690591", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1843", "id": 1353690591, "node_id": "IC_kwDOBm6k_c5Qr63f", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-15T20:49:05Z", "updated_at": "2022-12-15T20:49:05Z", "author_association": "OWNER", "body": "I have a nasty feeling the cleaner solution for this would involve porting my entire test suite from `def test_blah(app_client)` sync functions (which work due to a `@async_to_sync` call in `TestClient`) to `async def test_blah(async_fixture):` functions instead.\r\n\r\nI've been using that latter pattern for new tests (and plugin tests) for quite a while now, but I never took on the job of refactoring all of the old ones.\r\n\r\nA search for `(app_client):` across the whole project currently returns 194 results which might be a reasonable target to try switching to the new pattern as a starting point.\r\n\r\nNo idea if it will have much impact on the \"Too many open files\" errors though.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1408757705, "label": "Intermittent \"Too many open files\" error running tests"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1843#issuecomment-1353522652", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1843", "id": 1353522652, "node_id": "IC_kwDOBm6k_c5QrR3c", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-15T18:21:27Z", "updated_at": "2022-12-15T18:21:27Z", "author_association": "OWNER", "body": "I'll still use on-disk test databases for `is_immutable=True`, but not for the majority of tests.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1408757705, "label": "Intermittent \"Too many open files\" error running tests"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1843#issuecomment-1353522211", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1843", "id": 1353522211, "node_id": "IC_kwDOBm6k_c5QrRwj", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-15T18:21:02Z", "updated_at": "2022-12-15T18:21:02Z", "author_association": "OWNER", "body": "When I initially built this test suite Datasette didn't have the `memory_name=` mechanism for creating persistent in-memory databases.\r\n\r\nI'm going to see if I can switch to that for the majority of Datasette's tests. Might find that doing so both fixes this \"too many open files\" issue AND gives me a significant speed improvement to the test site too!\r\n\r\nHopefully I can do most of the work on that in this big ugly function:\r\n\r\nhttps://github.com/simonw/datasette/blob/dc18f62089e5672d03176f217d7840cdafa5c447/tests/fixtures.py#L104-L173", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1408757705, "label": "Intermittent \"Too many open files\" error running tests"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1843#issuecomment-1353520615", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1843", "id": 1353520615, "node_id": "IC_kwDOBm6k_c5QrRXn", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-15T18:19:25Z", "updated_at": "2022-12-15T18:19:25Z", "author_association": "OWNER", "body": "I've been seeing this error again:\r\n\r\n```\r\nERROR tests/test_api_write.py::test_create_table[input16-400-expected_response16] - OSError: [Errno 24] Too ...\r\nERROR tests/test_api_write.py::test_create_table[input17-400-expected_response17] - OSError: [Errno 24] Too ...\r\nERROR tests/test_api_write.py::test_create_table[input18-400-expected_response18] - OSError: [Errno 24] Too ...\r\n```\r\n\r\nIt doesn't happen in CI, and it turns out that's because CI runs `pytest -n auto` which splits the tests across multiple parallel processes.\r\n\r\nI've been working around the error on my laptop using `pytest -n auto` there too, but I'd rather not have to do that.\r\n\r\nThis is also getting in my way when I try to debug other issues, like this one:\r\n\r\n- #1955", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1408757705, "label": "Intermittent \"Too many open files\" error running tests"}, "performed_via_github_app": null}