From c0d25a7512120ee54a0fd168122f4bee7e68f50a Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Mon, 17 Jul 2023 14:50:10 -0700 Subject: [PATCH 1/2] Fixed failing test --- tests/test_query.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_query.py b/tests/test_query.py index d5ad08c..d565750 100644 --- a/tests/test_query.py +++ b/tests/test_query.py @@ -88,7 +88,9 @@ def test_aliases(mocker, tmpdir, httpx_mock): # Should have hit https://example.com/foo.json url = httpx_mock.get_request().url - assert url == "https://example.com/foo.json?sql=select+11+%2A+3&_shape=objects" + assert url.host == "example.com" + assert url.path == "/foo.json" + assert dict(url.params) == {"sql": "select 11 * 3", "_shape": "objects"} # Remove alias result = runner.invoke(cli, ["alias", "remove", "invalid"]) From 055d6a6ffc858e56dda4d43c6f906b90239a4257 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Mon, 17 Jul 2023 15:00:46 -0700 Subject: [PATCH 2/2] Swap appdirs for click.get_app_dir(), change dir from dclient to io.datasette.dclient - closes #10 --- dclient/cli.py | 3 +-- setup.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/dclient/cli.py b/dclient/cli.py index 8e64414..db5b510 100644 --- a/dclient/cli.py +++ b/dclient/cli.py @@ -1,12 +1,11 @@ import click import httpx import json -import appdirs import pathlib def get_config_dir(): - return pathlib.Path(appdirs.user_config_dir("dclient")) + return pathlib.Path(click.get_app_dir("io.datasette.dclient")) @click.group() diff --git a/setup.py b/setup.py index b1c1aee..7cc7600 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ setup( "datasette": ["client = dclient.plugin"], "console_scripts": ["dclient = dclient.cli:cli"], }, - install_requires=["click", "httpx", "appdirs"], + install_requires=["click", "httpx"], extras_require={ "test": [ "pytest",