Black + fix broken test

This commit is contained in:
Simon Willison 2019-05-11 14:45:59 -07:00
commit a187c81e0c
2 changed files with 13 additions and 6 deletions

View file

@ -11,7 +11,12 @@ def pytest_unconfigure(config):
def pytest_collection_modifyitems(items):
# Ensure test_black.py runs first before any asyncio code kicks in
test_black = [fn for fn in items if fn.name == "test_black"]
if test_black:
items.insert(0, items.pop(items.index(test_black[0])))
# Ensure test_black.py and test_inspect.py run first before any asyncio code kicks in
move_to_front(items, "test_black")
move_to_front(items, "test_inspect_cli")
def move_to_front(items, test_name):
test = [fn for fn in items if fn.name == test_name]
if test:
items.insert(0, items.pop(items.index(test[0])))

View file

@ -15,14 +15,16 @@ def test_inspect_cli(app_client):
assert 64 == len(database["hash"])
for table_name, expected_count in {
"Table With Space In Name": 0,
"facetable": 15
"facetable": 15,
}.items():
assert expected_count == database["tables"][table_name]["count"]
def test_inspect_cli_writes_to_file(app_client):
runner = CliRunner()
result = runner.invoke(cli, ["inspect", "fixtures.db", "--inspect-file", "foo.json"])
result = runner.invoke(
cli, ["inspect", "fixtures.db", "--inspect-file", "foo.json"]
)
assert 0 == result.exit_code, result.output
data = json.load(open("foo.json"))
assert ["fixtures"] == list(data.keys())