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/841#issuecomment-643576372 | https://api.github.com/repos/simonw/datasette/issues/841 | 643576372 | MDEyOklzc3VlQ29tbWVudDY0MzU3NjM3Mg== | 9599 | 2020-06-13T06:08:34Z | 2020-06-13T06:08:34Z | OWNER | Starlette achieves this. https://github.com/encode/starlette | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
638104520 | |
https://github.com/simonw/datasette/issues/834#issuecomment-643648359 | https://api.github.com/repos/simonw/datasette/issues/834 | 643648359 | MDEyOklzc3VlQ29tbWVudDY0MzY0ODM1OQ== | 9599 | 2020-06-13T16:47:29Z | 2020-06-13T16:47:29Z | OWNER | Implementing this is proving surprisingly tricky, because of the need to be able to optionally `await` the returned value. It's a bit of a fiddle to get this to work within unit tests because they run in non-async functions - due to this cunning `async_to_sync` usage in the test client: https://github.com/simonw/datasette/blob/b906030235efbdff536405d66078f4868ce0d3bd/tests/fixtures.py#L115-L133 I could switch to using `async def test_*` functions decorated with `@pytest.mark.asyncio` but I'd rather not re-engineer the entire test suite just for this one feature, so I'll try to find another way. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
637342551 | |
https://github.com/simonw/datasette/issues/841#issuecomment-643655108 | https://api.github.com/repos/simonw/datasette/issues/841 | 643655108 | MDEyOklzc3VlQ29tbWVudDY0MzY1NTEwOA== | 9599 | 2020-06-13T17:43:15Z | 2020-06-13T17:43:15Z | OWNER | Using https://pypi.org/project/pytest-cov/ and running `pytest --cov=datasette`: ``` ---------- coverage: platform darwin, python 3.7.7-final-0 ----------- Name Stmts Miss Cover -------------------------------------------------------- datasette/__init__.py 3 0 100% datasette/__main__.py 3 3 0% datasette/_version.py 277 152 45% datasette/actor_auth_cookie.py 19 3 84% datasette/app.py 499 27 95% datasette/cli.py 157 45 71% datasette/database.py 233 17 93% datasette/default_permissions.py 39 0 100% datasette/facets.py 209 24 89% datasette/filters.py 122 7 94% datasette/hookspecs.py 19 0 100% datasette/inspect.py 37 23 38% datasette/plugins.py 34 6 82% datasette/publish/__init__.py 0 0 100% datasette/publish/cloudrun.py 55 2 96% datasette/publish/common.py 19 1 95% datasette/publish/heroku.py 95 13 86% datasette/renderer.py 63 4 94% datasette/sql_functions.py 4 0 100% datasette/tracer.py 85 16 81% datasette/utils/__init__.py 503 31 94% datasette/utils/asgi.py 253 25 90% datasette/utils/shutil_backport.py 44 40 9% datasette/version.py 4 0 100% datasette/views/__init__.py 0 0 100% datasette/views/base.py 288 19 93% datasette/views/database.py 120 2 98% datasette/views/index.py 57 2 96% datasette/views/special.py 72 16 78% datasette/views/table.py 418 18 96% ---------------------------------… | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
638104520 | |
https://github.com/simonw/datasette/issues/841#issuecomment-643656053 | https://api.github.com/repos/simonw/datasette/issues/841 | 643656053 | MDEyOklzc3VlQ29tbWVudDY0MzY1NjA1Mw== | 9599 | 2020-06-13T17:50:34Z | 2020-06-13T17:50:34Z | OWNER | Added a `.coveragerc` file: ``` [run] omit = datasette/_version.py, datasette/utils/shutil_backport.py ``` And ran again: `pytest --cov=datasette --cov-config=.coveragerc` ``` Name Stmts Miss Cover ------------------------------------------------------ datasette/__init__.py 3 0 100% datasette/__main__.py 3 3 0% datasette/actor_auth_cookie.py 19 3 84% datasette/app.py 499 27 95% datasette/cli.py 157 45 71% datasette/database.py 233 17 93% datasette/default_permissions.py 39 0 100% datasette/facets.py 209 24 89% datasette/filters.py 122 7 94% datasette/hookspecs.py 19 0 100% datasette/inspect.py 37 23 38% datasette/plugins.py 34 6 82% datasette/publish/__init__.py 0 0 100% datasette/publish/cloudrun.py 55 2 96% datasette/publish/common.py 19 1 95% datasette/publish/heroku.py 95 13 86% datasette/renderer.py 63 4 94% datasette/sql_functions.py 4 0 100% datasette/tracer.py 85 16 81% datasette/utils/__init__.py 503 31 94% datasette/utils/asgi.py 253 25 90% datasette/version.py 4 0 100% datasette/views/__init__.py 0 0 100% datasette/views/base.py 288 19 93% datasette/views/database.py 120 2 98% datasette/views/index.py 57 2 96% datasette/views/special.py 72 16 78% datasette/views/table.py 418 18 96% ------------------------------------------------------ TOTAL 3410 304 91% ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
638104520 | |
https://github.com/simonw/datasette/issues/841#issuecomment-643657287 | https://api.github.com/repos/simonw/datasette/issues/841 | 643657287 | MDEyOklzc3VlQ29tbWVudDY0MzY1NzI4Nw== | 9599 | 2020-06-13T18:01:39Z | 2020-06-13T18:01:39Z | OWNER | Added `--cov-report html` and got this report: https://static.simonwillison.net/static/2020/htmlcov-issue-841/index.html | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
638104520 | |
https://github.com/simonw/datasette/issues/841#issuecomment-643658036 | https://api.github.com/repos/simonw/datasette/issues/841 | 643658036 | MDEyOklzc3VlQ29tbWVudDY0MzY1ODAzNg== | 9599 | 2020-06-13T18:08:13Z | 2020-06-13T18:08:13Z | OWNER | From digging through that report it looks like the majority stuff that isn't fully covered is corner-cases... which are the kind of things I really do want the tests to catch. I'm not entirely ready to commit to 100%, but I'm going to start digging through and seeing how close I can get. If I can get to 98% (I'm on 91% already) I may as well push all the way to 100. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
638104520 | |
https://github.com/simonw/datasette/issues/841#issuecomment-643660427 | https://api.github.com/repos/simonw/datasette/issues/841 | 643660427 | MDEyOklzc3VlQ29tbWVudDY0MzY2MDQyNw== | 9599 | 2020-06-13T18:29:30Z | 2020-06-13T18:29:36Z | OWNER | This one looks easy enough to fix: <img width="757" alt="Coverage_for_datasette_actor_auth_cookie_py__84_" src="https://user-images.githubusercontent.com/9599/84576366-15f88000-ad69-11ea-906b-efa15d3735a4.png"> | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
638104520 | |
https://github.com/simonw/datasette/issues/841#issuecomment-643660757 | https://api.github.com/repos/simonw/datasette/issues/841 | 643660757 | MDEyOklzc3VlQ29tbWVudDY0MzY2MDc1Nw== | 9599 | 2020-06-13T18:32:20Z | 2020-06-13T18:32:20Z | OWNER | Looking at options for publishing coverage reports: * https://github.com/codecov/codecov-action * https://github.com/coveralls-clients/coveralls-python I'm going to try https://codecov.io/ | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
638104520 | |
https://github.com/simonw/datasette/issues/841#issuecomment-643661125 | https://api.github.com/repos/simonw/datasette/issues/841 | 643661125 | MDEyOklzc3VlQ29tbWVudDY0MzY2MTEyNQ== | 9599 | 2020-06-13T18:35:30Z | 2020-06-13T18:36:50Z | OWNER | I ran export CODECOV_TOKEN="f7935cad...", then ran this: ``` datasette $ bash <(curl -s https://codecov.io/bash) _____ _ / ____| | | | | ___ __| | ___ ___ _____ __ | | / _ \ / _` |/ _ \/ __/ _ \ \ / / | |___| (_) | (_| | __/ (_| (_) \ V / \_____\___/ \__,_|\___|\___\___/ \_/ Bash-20200602-f809a24 x> No CI provider detected. Testing inside Docker? http://docs.codecov.io/docs/testing-with-docker Testing with Tox? https://docs.codecov.io/docs/python#section-testing-with-tox project root: . --> token set from env Yaml not found, that's ok! Learn more at http://docs.codecov.io/docs/codecov-yaml ==> Running gcov in . (disable via -X gcov) ==> Searching for coverage reports in: + . -> Found 1 reports ==> Detecting git/mercurial file structure ==> Reading reports + ./coverage.xml bytes=139174 ==> Appending adjustments https://docs.codecov.io/docs/fixing-reports -> No adjustments found ==> Gzipping contents ==> Uploading reports url: https://codecov.io query: branch=master&commit=0e49842e227a0f1f69d48108c87d17fe0379e548&build=&build_url=&name=&tag=&slug=simonw%2Fdatasette&service=&flags=&pr=&job= -> Pinging Codecov https://codecov.io/upload/v4?package=bash-20200602-f809a24&token=secret&branch=master&commit=0e49842e227a0f1f69d48108c87d17fe0379e548&build=&build_url=&name=&tag=&slug=simonw%2Fdatasette&service=&flags=&pr=&job= -> Uploading -> View reports at https://codecov.io/github/simonw/datasette/commit/0e49842e227a0f1f69d48108c87d17fe0379e548 ``` But https://codecov.io/github/simonw/datasette/commit/0e49842e227a0f1f69d48108c87d17fe0379e548 is a 404, so it doesn't seem to have worked? UPDATE: It works now, took about 30 seconds before the report showed up at that URL. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
638104520 | |
https://github.com/simonw/datasette/issues/842#issuecomment-643663005 | https://api.github.com/repos/simonw/datasette/issues/842 | 643663005 | MDEyOklzc3VlQ29tbWVudDY0MzY2MzAwNQ== | 9599 | 2020-06-13T18:51:57Z | 2020-06-13T18:51:57Z | OWNER | Two potential designs: - `_actor_id`, `_request_ip`, `_now_timestamp` - so special reserved parameters - a SQL function: `update blah set up = special('ip')` I fee the first would be easier to implement. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
638212085 | |
https://github.com/simonw/datasette/issues/843#issuecomment-643676069 | https://api.github.com/repos/simonw/datasette/issues/843 | 643676069 | MDEyOklzc3VlQ29tbWVudDY0MzY3NjA2OQ== | 9599 | 2020-06-13T20:45:29Z | 2020-06-13T20:45:29Z | OWNER | I set up https://codecov.io/gh/simonw/datasette/settings and added a `CODECOV_TOKEN` to the GitHub Actions secrets for this repo. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
638229448 | |
https://github.com/simonw/datasette/issues/843#issuecomment-643676314 | https://api.github.com/repos/simonw/datasette/issues/843 | 643676314 | MDEyOklzc3VlQ29tbWVudDY0MzY3NjMxNA== | 9599 | 2020-06-13T20:47:37Z | 2020-06-13T20:47:37Z | OWNER | I can use this action: https://github.com/codecov/codecov-action | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
638229448 | |
https://github.com/simonw/datasette/pull/844#issuecomment-643681517 | https://api.github.com/repos/simonw/datasette/issues/844 | 643681517 | MDEyOklzc3VlQ29tbWVudDY0MzY4MTUxNw== | 9599 | 2020-06-13T21:36:15Z | 2020-06-13T21:36:15Z | OWNER | OK, this works now: https://codecov.io/gh/simonw/datasette/tree/1210d9f41841bdca450f85a2342cdb0ff339c1b4 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
638230433 | |
https://github.com/simonw/datasette/issues/841#issuecomment-643681747 | https://api.github.com/repos/simonw/datasette/issues/841 | 643681747 | MDEyOklzc3VlQ29tbWVudDY0MzY4MTc0Nw== | 9599 | 2020-06-13T21:38:46Z | 2020-06-13T21:38:46Z | OWNER | Closing this because I've researched feasibility. I may start a milestone in the future to help me get to 100%. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
638104520 | |
https://github.com/simonw/datasette/issues/846#issuecomment-643685207 | https://api.github.com/repos/simonw/datasette/issues/846 | 643685207 | MDEyOklzc3VlQ29tbWVudDY0MzY4NTIwNw== | 9599 | 2020-06-13T22:18:01Z | 2020-06-13T22:18:01Z | OWNER | This shows currently open files (after `pip install psutil`): ``` import psutil psutil.Process().open_files() ``` I ran it inside `pytest -x --pdb` and got this: ``` > /Users/simon/.local/share/virtualenvs/datasette-AWNrQs95/lib/python3.7/site-packages/jinja2/utils.py(154)open_if_exists() -> return open(filename, mode) (Pdb) import psutil (Pdb) psutil.Process().open_files() popenfile(path='/private/var/folders/wr/hn3206rs1yzgq3r49bz8nvnh0000gn/T/tmp9uhx5d8x/fixtures.db', fd=10), popenfile(path='/private/var/folders/wr/hn3206rs1yzgq3r49bz8nvnh0000gn/T/tmpyfw44ica/fixtures.dot.db', fd=11), popenfile(path='/private/var/folders/wr/hn3206rs1yzgq3r49bz8nvnh0000gn/T/tmpyrg6g48b/fixtures.db', fd=12), popenfile(path='/private/var/folders/wr/hn3206rs1yzgq3r49bz8nvnh0000gn/T/tmp33kkg62s/fixtures.db', fd=13), popenfile(path='/private/var/folders/wr/hn3206rs1yzgq3r49bz8nvnh0000gn/T/tmp33kkg62s/fixtures.db', fd=14), popenfile(path='/private/var/folders/wr/hn3206rs1yzgq3r49bz8nvnh0000gn/T/tmp33kkg62s/fixtures.db', fd=15), popenfile(path='/private/var/folders/wr/hn3206rs1yzgq3r49bz8nvnh0000gn/T/tmp33kkg62s/fixtures.db', fd=16), popenfile(path='/private/var/folders/wr/hn3206rs1yzgq3r49bz8nvnh0000gn/T/tmp33kkg62s/fixtures.db', fd=17), popenfile(path='/private/var/folders/wr/hn3206rs1yzgq3r49bz8nvnh0000gn/T/tmp33kkg62s/fixtures.db', fd=18), popenfile(path='/private/var/folders/wr/hn3206rs1yzgq3r49bz8nvnh0000gn/T/tmp33kkg62s/fixtures.db', fd=19), popenfile(path='/private/var/folders/wr/hn3206rs1yzgq3r49bz8nvnh0000gn/T/tmpng4lg84_/fixtures.db', fd=20), popenfile(path='/private/var/folders/wr/hn3206rs1yzgq3r49bz8nvnh0000gn/T/tmp9uhx5d8x/fixtures.db', fd=21), popenfile(path='/private/var/folders/wr/hn3206rs1yzgq3r49bz8nvnh0000gn/T/tmp9uhx5d8x/fixtures.db', fd=22), popenfile(path='/private/var/folders/wr/hn3206rs1yzgq3r49bz8nvnh0000gn/T/tmp9uhx5d8x/fixtures.db', fd=23), popenfile(path='/private/var/folders/wr/hn3206rs1yzgq3r49bz8nvnh0000gn/T/tmph11oalw_/fixtures.db', fd=24), popenfile(path='/private/var/folde… | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
638241779 | |
https://github.com/simonw/datasette/issues/846#issuecomment-643685333 | https://api.github.com/repos/simonw/datasette/issues/846 | 643685333 | MDEyOklzc3VlQ29tbWVudDY0MzY4NTMzMw== | 9599 | 2020-06-13T22:19:38Z | 2020-06-13T22:19:38Z | OWNER | That's 91 open files but only 29 unique filenames. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
638241779 | |
https://github.com/simonw/datasette/issues/846#issuecomment-643685669 | https://api.github.com/repos/simonw/datasette/issues/846 | 643685669 | MDEyOklzc3VlQ29tbWVudDY0MzY4NTY2OQ== | 9599 | 2020-06-13T22:24:22Z | 2020-06-13T22:24:22Z | OWNER | I tried this experiment: ```python import sqlite3, psutil def show_things(): conn = sqlite3.connect("fixtures.db") tables = [r[0] for r in conn.execute("select * from sqlite_master").fetchall()] return tables print(psutil.Process().open_files()) print(show_things()) print(psutil.Process().open_files()) ``` To see if the connection would be automatically released when the `conn` variable was garbage collected at the end of the function... and it was correctly released - the two calls to `open_files()` showed that the file did not remain open. Likewise: ``` In [11]: conn = sqlite3.connect("fixtures.db") In [12]: psutil.Process().open_files() Out[12]: [popenfile(path='/Users/simon/.ipython/profile_default/history.sqlite', fd=4), popenfile(path='/Users/simon/.ipython/profile_default/history.sqlite', fd=5), popenfile(path='/Users/simon/Dropbox/Development/datasette/fixtures.db', fd=12)] In [13]: del conn In [14]: psutil.Process().open_files() Out[14]: [popenfile(path='/Users/simon/.ipython/profile_default/history.sqlite', fd=4), popenfile(path='/Users/simon/.ipython/profile_default/history.sqlite', fd=5)] ``` So presumably there's something about the way my pytest fixtures work that's causing the many different `Datasette()` instances and their underlying SQLite connections that I… | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
638241779 |