Ensure test_black.py executes first under pytest

Otherwise it throws an exception because it gets disrupted by the
asyncio activity in the other tests.
This commit is contained in:
Simon Willison 2019-05-03 21:25:49 -04:00
commit ade6bae472
2 changed files with 6 additions and 4 deletions

View file

@ -8,3 +8,9 @@ def pytest_unconfigure(config):
import sys
del sys._called_from_test
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"][0]
items.insert(0, items.pop(items.index(test_black)))