home / github / issue_comments

Menu
  • GraphQL API

issue_comments: 1129241283

This data as json

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/1744#issuecomment-1129241283 https://api.github.com/repos/simonw/datasette/issues/1744 1129241283 IC_kwDOBm6k_c5DTtrD 9599 2022-05-17T19:32:35Z 2022-05-17T19:32:35Z OWNER I tried writing a test like this: ```python @pytest.mark.parametrize("locked", (True, False)) def test_locked_sqlite_db(tmp_path_factory, locked): dir = tmp_path_factory.mktemp("test_locked_sqlite_db") test_db = str(dir / "test.db") sqlite3.connect(test_db).execute("create table t (id integer primary key)") if locked: fp = open(test_db, "w") fcntl.lockf(fp.fileno(), fcntl.LOCK_EX) runner = CliRunner() result = runner.invoke( cli, [ "serve", "--memory", "--get", "/test", ], catch_exceptions=False, ) ``` But it didn't work, because the test runs in the same process - so taking an exclusive lock on that file didn't cause an error when the test later tried to access it via Datasette! {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} 1239008850  
Powered by Datasette · Queries took 53.032ms