{"html_url": "https://github.com/simonw/datasette/pull/539#issuecomment-508343497", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/539", "id": 508343497, "node_id": "MDEyOklzc3VlQ29tbWVudDUwODM0MzQ5Nw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-07-04T05:28:30Z", "updated_at": "2019-07-04T05:28:30Z", "author_association": "OWNER", "body": "This seems to have fixed the weird errors: https://github.com/simonw/datasette/pull/539/commits/fd6164b03ebe450a9a00df2e5be2dc7bbfbd9a3f", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 464040911, "label": "Secret plugin configuration options"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/539#issuecomment-508343359", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/539", "id": 508343359, "node_id": "MDEyOklzc3VlQ29tbWVudDUwODM0MzM1OQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-07-04T05:27:47Z", "updated_at": "2019-07-04T05:27:47Z", "author_association": "OWNER", "body": "For some reason the way I have set these tests up keeps throwing [variations on this error](https://travis-ci.org/simonw/datasette/builds/554055865):\r\n```\r\nself = \r\n @contextlib.contextmanager\r\n def isolated_filesystem(self):\r\n \"\"\"A context manager that creates a temporary folder and changes\r\n the current working directory to it for isolated filesystem tests.\r\n \"\"\"\r\n> cwd = os.getcwd()\r\nE FileNotFoundError: [Errno 2] No such file or directory\r\n/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/click/testing.py:364: FileNotFoundError\r\n```\r\nAfter much trial and error the cause appears to be the way I was trying to create custom metadata like so:\r\n```python\r\n def test_plugin_config_env():\r\n os.environ[\"FOO_ENV\"] = \"FROM_ENVIRONMENT\"\r\n for client in make_app_client(\r\n metadata={\"plugins\": {\"env-plugin\": {\"foo\": {\"$env\": \"FOO_ENV\"}}}}\r\n ):\r\n assert {\"foo\": \"FROM_ENVIRONMENT\"} == client.ds.plugin_config(\"env-plugin\")\r\n del os.environ[\"FOO_ENV\"]\r\n```\r\nIt wasnt't the `os.environ` manipulation OR the `tempfile` stuff - it appeared to be the usage of `make_app_client()`. When I stopped trying to do that (and moved my test configuration into `METADATA` in the `fixtures.py` module) the tests started passing again.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 464040911, "label": "Secret plugin configuration options"}, "performed_via_github_app": null}