mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
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:
parent
f9193e7a18
commit
ade6bae472
2 changed files with 6 additions and 4 deletions
|
|
@ -8,3 +8,9 @@ def pytest_unconfigure(config):
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
del sys._called_from_test
|
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)))
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,6 @@ import sys
|
||||||
code_root = Path(__file__).parent.parent
|
code_root = Path(__file__).parent.parent
|
||||||
|
|
||||||
|
|
||||||
# @pytest.mark.skipif(
|
|
||||||
# sys.version_info[:2] > (3, 6),
|
|
||||||
# reason="Breaks on 3.7 at the moment, but it only needs to run under one Python version",
|
|
||||||
# )
|
|
||||||
def test_black():
|
def test_black():
|
||||||
runner = CliRunner()
|
runner = CliRunner()
|
||||||
result = runner.invoke(
|
result = runner.invoke(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue