Nicer pattern for make_app_client() in tests, closes #395

This commit is contained in:
Simon Willison 2020-06-07 14:14:10 -07:00
commit abc7339124
7 changed files with 56 additions and 42 deletions

View file

@ -41,7 +41,7 @@ def test_inspect_cli_writes_to_file(app_client):
def test_serve_with_inspect_file_prepopulates_table_counts_cache():
inspect_data = {"fixtures": {"tables": {"hithere": {"count": 44}}}}
for client in make_app_client(inspect_data=inspect_data, is_immutable=True):
with make_app_client(inspect_data=inspect_data, is_immutable=True) as client:
assert inspect_data == client.ds.inspect_data
db = client.ds.databases["fixtures"]
assert {"hithere": 44} == db.cached_table_counts