{"html_url": "https://github.com/simonw/datasette/issues/1809#issuecomment-1249985741", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1809", "id": 1249985741, "node_id": "IC_kwDOBm6k_c5KgUTN", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-09-17T03:04:51Z", "updated_at": "2022-09-17T03:04:51Z", "author_association": "OWNER", "body": "I'm going to throw an error in `ds.render_template()` if you haven't previously called `await ds.invoke_startup()`.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1373595927, "label": "`prepare_jinja2_environment()` hook should take `datasette` argument"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1809#issuecomment-1249985971", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1809", "id": 1249985971, "node_id": "IC_kwDOBm6k_c5KgUWz", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-09-17T03:06:32Z", "updated_at": "2022-09-17T03:06:32Z", "author_association": "OWNER", "body": "This is likely going to cause some tests in plugins to break, but I'm OK with that - I'll fix them as I find them once this release is out.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1373595927, "label": "`prepare_jinja2_environment()` hook should take `datasette` argument"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1809#issuecomment-1249986079", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1809", "id": 1249986079, "node_id": "IC_kwDOBm6k_c5KgUYf", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-09-17T03:07:24Z", "updated_at": "2022-09-17T03:07:24Z", "author_association": "OWNER", "body": "Datasette's own tests started to break because calls to the `TestClient` were performed without awaiting that method. I fixed that by adding this to `_request()` inside that class:\r\n\r\n```python\r\n async def _request(\r\n self,\r\n path,\r\n follow_redirects=True,\r\n redirect_count=0,\r\n method=\"GET\",\r\n cookies=None,\r\n headers=None,\r\n post_body=None,\r\n content_type=None,\r\n if_none_match=None,\r\n ):\r\n if not self.ds._startup_invoked:\r\n await self.ds.invoke_startup()\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1373595927, "label": "`prepare_jinja2_environment()` hook should take `datasette` argument"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1809#issuecomment-1249987643", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1809", "id": 1249987643, "node_id": "IC_kwDOBm6k_c5KgUw7", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-09-17T03:19:24Z", "updated_at": "2022-09-17T03:19:24Z", "author_association": "OWNER", "body": "In looking at the documentation on [writing tests](https://docs.datasette.io/en/latest/testing_plugins.html), there are a lot of examples like this:\r\n```python\r\n def test_that_opens_the_debugger_or_errors():\r\n ds = Datasette([db_path], pdb=True)\r\n response = await ds.client.get(\"/\")\r\n```\r\nI really don't like having to tell people to add `await ds.invoke_startup()` to every test that might look like this.\r\n\r\nSince it's safe to call that function multiple times, I'm going to have `ds.client.get()` and friends call it for you too - so if you forget in a plugin test it won't matter.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1373595927, "label": "`prepare_jinja2_environment()` hook should take `datasette` argument"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1809#issuecomment-1249990033", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1809", "id": 1249990033, "node_id": "IC_kwDOBm6k_c5KgVWR", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-09-17T03:39:05Z", "updated_at": "2022-09-17T03:39:05Z", "author_association": "OWNER", "body": "New docs section on the need to call `await ds.invoke_startup()`: https://github.com/simonw/datasette/blob/ddc999ad1296e8c69cffede3e367dda059b8adad/docs/testing_plugins.rst#setting-up-a-datasette-test-instance", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1373595927, "label": "`prepare_jinja2_environment()` hook should take `datasette` argument"}, "performed_via_github_app": null}