github
html_url | issue_url | id | node_id | user | created_at | updated_at | author_association | body | reactions | issue | performed_via_github_app |
---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/simonw/datasette/issues/1809#issuecomment-1249990033 | https://api.github.com/repos/simonw/datasette/issues/1809 | 1249990033 | IC_kwDOBm6k_c5KgVWR | 9599 | 2022-09-17T03:39:05Z | 2022-09-17T03:39:05Z | OWNER | 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 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1373595927 | |
https://github.com/simonw/datasette/issues/1809#issuecomment-1249987643 | https://api.github.com/repos/simonw/datasette/issues/1809 | 1249987643 | IC_kwDOBm6k_c5KgUw7 | 9599 | 2022-09-17T03:19:24Z | 2022-09-17T03:19:24Z | OWNER | 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: ```python def test_that_opens_the_debugger_or_errors(): ds = Datasette([db_path], pdb=True) response = await ds.client.get("/") ``` I really don't like having to tell people to add `await ds.invoke_startup()` to every test that might look like this. Since 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. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1373595927 | |
https://github.com/simonw/datasette/issues/1809#issuecomment-1249986079 | https://api.github.com/repos/simonw/datasette/issues/1809 | 1249986079 | IC_kwDOBm6k_c5KgUYf | 9599 | 2022-09-17T03:07:24Z | 2022-09-17T03:07:24Z | OWNER | 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: ```python async def _request( self, path, follow_redirects=True, redirect_count=0, method="GET", cookies=None, headers=None, post_body=None, content_type=None, if_none_match=None, ): if not self.ds._startup_invoked: await self.ds.invoke_startup() ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1373595927 | |
https://github.com/simonw/datasette/issues/1809#issuecomment-1249985971 | https://api.github.com/repos/simonw/datasette/issues/1809 | 1249985971 | IC_kwDOBm6k_c5KgUWz | 9599 | 2022-09-17T03:06:32Z | 2022-09-17T03:06:32Z | OWNER | 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. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1373595927 | |
https://github.com/simonw/datasette/issues/1809#issuecomment-1249985741 | https://api.github.com/repos/simonw/datasette/issues/1809 | 1249985741 | IC_kwDOBm6k_c5KgUTN | 9599 | 2022-09-17T03:04:51Z | 2022-09-17T03:04:51Z | OWNER | I'm going to throw an error in `ds.render_template()` if you haven't previously called `await ds.invoke_startup()`. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1373595927 |