home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

8 rows where issue = 956303470 and user = 9599 sorted by updated_at descending

✖
✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date)

user 1

  • simonw · 8 ✖

issue 1

  • Tests failing with FileNotFoundError in runner.isolated_filesystem · 8 ✖

author_association 1

  • OWNER 8
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
890390342 https://github.com/simonw/datasette/issues/1406#issuecomment-890390342 https://api.github.com/repos/simonw/datasette/issues/1406 IC_kwDOBm6k_c41EkdG simonw 9599 2021-07-31T18:56:35Z 2021-07-31T18:56:35Z OWNER

But... I've lost enough time to this already, and removing runner.isolated_filesystem() has the tests passing again. So I'm not going to work on this any more.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Tests failing with FileNotFoundError in runner.isolated_filesystem 956303470  
890390198 https://github.com/simonw/datasette/issues/1406#issuecomment-890390198 https://api.github.com/repos/simonw/datasette/issues/1406 IC_kwDOBm6k_c41Eka2 simonw 9599 2021-07-31T18:55:33Z 2021-07-31T18:55:33Z OWNER

To clarify: the core problem here is that an error is thrown any time you call os.getcwd() but the directory you are currently in has been deleted.

runner.isolated_filesystem() assumes that the current directory in has not been deleted. But the various temporary directory utilities in pytest work by creating directories and then deleting them.

Maybe there's a larger problem here that I play a bit fast and loose with os.chdir() in both the test suite and in various lines of code in Datasette itself (in particular in the publish commands)?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Tests failing with FileNotFoundError in runner.isolated_filesystem 956303470  
890259755 https://github.com/simonw/datasette/issues/1406#issuecomment-890259755 https://api.github.com/repos/simonw/datasette/issues/1406 IC_kwDOBm6k_c41EEkr simonw 9599 2021-07-31T00:04:54Z 2021-07-31T00:04:54Z OWNER

STILL failing. I'm going to try removing all instances of isolated_filesystem() in favour of a different pattern using pytest temporary files, then see if I can get that to work without the serial hack.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Tests failing with FileNotFoundError in runner.isolated_filesystem 956303470  
889555977 https://github.com/simonw/datasette/issues/1406#issuecomment-889555977 https://api.github.com/repos/simonw/datasette/issues/1406 IC_kwDOBm6k_c41BYwJ simonw 9599 2021-07-30T01:06:57Z 2021-07-30T01:06:57Z OWNER

Looking at the source code in Click for isolated_filesystem(): https://github.com/pallets/click/blob/9da166957f5848b641231d485467f6140bca2bc0/src/click/testing.py#L450-L468

python @contextlib.contextmanager def isolated_filesystem( self, temp_dir: t.Optional[t.Union[str, os.PathLike]] = None ) -> t.Iterator[str]: """A context manager that creates a temporary directory and changes the current working directory to it. This isolates tests that affect the contents of the CWD to prevent them from interfering with each other. :param temp_dir: Create the temporary directory under this directory. If given, the created directory is not removed when exiting. .. versionchanged:: 8.0 Added the ``temp_dir`` parameter. """ cwd = os.getcwd() t = tempfile.mkdtemp(dir=temp_dir) os.chdir(t) How about if I pass in that optional temp_dir as a temp directory created using the pytest-xdist aware pytest mechanisms: https://docs.pytest.org/en/6.2.x/tmpdir.html

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Tests failing with FileNotFoundError in runner.isolated_filesystem 956303470  
889553052 https://github.com/simonw/datasette/issues/1406#issuecomment-889553052 https://api.github.com/repos/simonw/datasette/issues/1406 IC_kwDOBm6k_c41BYCc simonw 9599 2021-07-30T00:58:43Z 2021-07-30T00:58:43Z OWNER

Tests are still failing in the job that calculates coverage.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Tests failing with FileNotFoundError in runner.isolated_filesystem 956303470  
889550391 https://github.com/simonw/datasette/issues/1406#issuecomment-889550391 https://api.github.com/repos/simonw/datasette/issues/1406 IC_kwDOBm6k_c41BXY3 simonw 9599 2021-07-30T00:49:31Z 2021-07-30T00:49:31Z OWNER

That fixed it. My hunch is that Click's runner.isolated_filesystem() mechanism doesn't play well with pytest-xdist.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Tests failing with FileNotFoundError in runner.isolated_filesystem 956303470  
889548536 https://github.com/simonw/datasette/issues/1406#issuecomment-889548536 https://api.github.com/repos/simonw/datasette/issues/1406 IC_kwDOBm6k_c41BW74 simonw 9599 2021-07-30T00:43:47Z 2021-07-30T00:43:47Z OWNER

Still couldn't replicate on my laptop. On a hunch, I'm going to add @pytest.mark.serial to every test that uses runner.isolated_filesystem().

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Tests failing with FileNotFoundError in runner.isolated_filesystem 956303470  
889547142 https://github.com/simonw/datasette/issues/1406#issuecomment-889547142 https://api.github.com/repos/simonw/datasette/issues/1406 IC_kwDOBm6k_c41BWmG simonw 9599 2021-07-30T00:39:49Z 2021-07-30T00:39:49Z OWNER

It happens in CI but not on my laptop. I think I need to run the tests on my laptop like this: https://github.com/simonw/datasette/blob/121e10c29c5b412fddf0326939f1fe46c3ad9d4a/.github/workflows/test.yml#L27-L30

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Tests failing with FileNotFoundError in runner.isolated_filesystem 956303470  

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
, [performed_via_github_app] TEXT);
CREATE INDEX [idx_issue_comments_issue]
                ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
                ON [issue_comments] ([user]);
Powered by Datasette · Queries took 1128.364ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows