Rename config= to settings=, refs #1432

This commit is contained in:
Simon Willison 2021-08-12 18:10:36 -07:00
commit 07b6c9dd35
10 changed files with 35 additions and 33 deletions

View file

@ -99,7 +99,7 @@ def make_app_client(
max_returned_rows=None,
cors=False,
memory=False,
config=None,
settings=None,
filename="fixtures.db",
is_immutable=False,
extra_databases=None,
@ -129,7 +129,7 @@ def make_app_client(
# Insert at start to help test /-/databases ordering:
files.insert(0, extra_filepath)
os.chdir(os.path.dirname(filepath))
config = config or {}
settings = settings or {}
for key, value in {
"default_page_size": 50,
"max_returned_rows": max_returned_rows or 100,
@ -138,8 +138,8 @@ def make_app_client(
# errors when running the full test suite:
"num_sql_threads": 1,
}.items():
if key not in config:
config[key] = value
if key not in settings:
settings[key] = value
ds = Datasette(
files,
immutables=immutables,
@ -147,7 +147,7 @@ def make_app_client(
cors=cors,
metadata=metadata or METADATA,
plugins_dir=PLUGINS_DIR,
config=config,
settings=settings,
inspect_data=inspect_data,
static_mounts=static_mounts,
template_dir=template_dir,
@ -171,7 +171,7 @@ def app_client_no_files():
@pytest.fixture(scope="session")
def app_client_base_url_prefix():
with make_app_client(config={"base_url": "/prefix/"}) as client:
with make_app_client(settings={"base_url": "/prefix/"}) as client:
yield client
@ -210,13 +210,13 @@ def app_client_two_attached_databases_one_immutable():
@pytest.fixture(scope="session")
def app_client_with_hash():
with make_app_client(config={"hash_urls": True}, is_immutable=True) as client:
with make_app_client(settings={"hash_urls": True}, is_immutable=True) as client:
yield client
@pytest.fixture(scope="session")
def app_client_with_trace():
with make_app_client(config={"trace_debug": True}, is_immutable=True) as client:
with make_app_client(settings={"trace_debug": True}, is_immutable=True) as client:
yield client
@ -234,13 +234,13 @@ def app_client_returned_rows_matches_page_size():
@pytest.fixture(scope="session")
def app_client_larger_cache_size():
with make_app_client(config={"cache_size_kb": 2500}) as client:
with make_app_client(settings={"cache_size_kb": 2500}) as client:
yield client
@pytest.fixture(scope="session")
def app_client_csv_max_mb_one():
with make_app_client(config={"max_csv_mb": 1}) as client:
with make_app_client(settings={"max_csv_mb": 1}) as client:
yield client