Skip to content

Commit eb6ae7a

Browse files
committed
Disable pytest-asyncio
Seems to conflict with pytest-tornasync. And pytest-tornasync should be capable of running the async tests itself anyway
1 parent 09d66bb commit eb6ae7a

6 files changed

+3
-38
lines changed

cylc/uiserver/tests/conftest.py

-21
Original file line numberDiff line numberDiff line change
@@ -72,27 +72,6 @@ def async_client():
7272
return AsyncClientFixture()
7373

7474

75-
@pytest.fixture(scope='module')
76-
def event_loop():
77-
"""This fixture defines the event loop used for each test.
78-
79-
The overrides the default function-scope for this pytest-asyncio fixture,
80-
allowing module scoped async fixtures. It means all tests in a module
81-
will run in the same event loop. This is fine, it's actually an
82-
efficiency win but also something to be aware of.
83-
84-
See: https://github.com/pytest-dev/pytest-asyncio/issues/171
85-
"""
86-
loop = asyncio.get_event_loop_policy().new_event_loop()
87-
yield loop
88-
# gracefully exit async generators
89-
loop.run_until_complete(loop.shutdown_asyncgens())
90-
# cancel any tasks still running in this event loop
91-
for task in asyncio.all_tasks(loop):
92-
task.cancel()
93-
loop.close()
94-
95-
9675
@pytest.fixture
9776
def workflows_manager() -> WorkflowsManager:
9877
return WorkflowsManager(None, logging.getLogger('cylc'))

cylc/uiserver/tests/test_data_store_mgr.py

-8
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from .conftest import AsyncClientFixture
3030

3131

32-
@pytest.mark.asyncio
3332
async def test_entire_workflow_update(
3433
async_client: AsyncClientFixture,
3534
data_store_mgr: DataStoreMgr,
@@ -61,7 +60,6 @@ async def test_entire_workflow_update(
6160
assert entire_workflow.workflow.id == w_id_data['workflow'].id
6261

6362

64-
@pytest.mark.asyncio
6563
async def test_entire_workflow_update_ignores_timeout_message(
6664
async_client: AsyncClientFixture,
6765
data_store_mgr: DataStoreMgr
@@ -89,7 +87,6 @@ async def test_entire_workflow_update_ignores_timeout_message(
8987
assert w_id not in data_store_mgr.data
9088

9189

92-
@pytest.mark.asyncio
9390
async def test_entire_workflow_update_gather_error(
9491
async_client: AsyncClientFixture,
9592
data_store_mgr: DataStoreMgr,
@@ -128,7 +125,6 @@ async def test_entire_workflow_update_gather_error(
128125
assert caplog.records[0].exc_info[0] == error_type
129126

130127

131-
@pytest.mark.asyncio
132128
async def test_register_workflow(
133129
data_store_mgr: DataStoreMgr
134130
):
@@ -141,7 +137,6 @@ async def test_register_workflow(
141137
assert w_id in data_store_mgr.delta_queues
142138

143139

144-
@pytest.mark.asyncio
145140
async def test_update_contact_no_contact_data(
146141
data_store_mgr: DataStoreMgr
147142
):
@@ -154,7 +149,6 @@ async def test_update_contact_no_contact_data(
154149
assert api_version == data_store_mgr.data[w_id]['workflow'].api_version
155150

156151

157-
@pytest.mark.asyncio
158152
async def test_update_contact_with_contact_data(
159153
data_store_mgr: DataStoreMgr
160154
):
@@ -174,7 +168,6 @@ async def test_update_contact_with_contact_data(
174168
assert api_version == data_store_mgr.data[w_id]['workflow'].api_version
175169

176170

177-
@pytest.mark.asyncio
178171
async def test_disconnect_workflow(
179172
data_store_mgr: DataStoreMgr
180173
):
@@ -197,7 +190,6 @@ async def test_disconnect_workflow(
197190
assert data_store_mgr.data[w_id]['workflow'].api_version == 0
198191

199192

200-
@pytest.mark.asyncio
201193
async def test_workflow_connect_fail(
202194
data_store_mgr: DataStoreMgr,
203195
port_range,

cylc/uiserver/tests/test_workflows_mgr.py

-7
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040

4141
# --- workflow_request
4242

43-
@pytest.mark.asyncio
4443
async def test_workflow_request_client_timeout(
4544
async_client: AsyncClientFixture):
4645
async_client.will_return(ClientTimeout)
@@ -49,7 +48,6 @@ async def test_workflow_request_client_timeout(
4948
assert 'timeout' in msg.lower() # type: ignore[attr-defined]
5049

5150

52-
@pytest.mark.asyncio
5351
async def test_workflow_request_client_error(
5452
async_client: AsyncClientFixture, caplog):
5553
caplog.set_level(logging.CRITICAL, logger='cylc')
@@ -59,7 +57,6 @@ async def test_workflow_request_client_error(
5957
assert not msg
6058

6159

62-
@pytest.mark.asyncio
6360
@pytest.mark.parametrize(
6461
"returns,command,req_context,expected_ctx,expected_msg",
6562
[
@@ -125,7 +122,6 @@ def mk_flow(path, reg, active=True, database=True):
125122
)
126123

127124

128-
@pytest.mark.asyncio
129125
@pytest.mark.parametrize(
130126
# generate all possible normal state changes
131127
'active_before,active_after',
@@ -169,7 +165,6 @@ async def test_workflow_state_changes(tmp_path, active_before, active_after):
169165
'active_before,active_after',
170166
product([True, False], repeat=2)
171167
)
172-
@pytest.mark.asyncio
173168
async def test_workflow_state_change_uuid(
174169
tmp_path,
175170
active_before,
@@ -229,7 +224,6 @@ async def test_workflow_state_change_uuid(
229224
assert changes[0][3][CFF.UUID] == '42'
230225

231226

232-
@pytest.mark.asyncio
233227
async def test_multi_request(
234228
workflows_manager,
235229
async_client: AsyncClientFixture
@@ -259,7 +253,6 @@ async def test_multi_request(
259253
assert value == response[0]
260254

261255

262-
@pytest.mark.asyncio
263256
async def test_multi_request_gather_errors(
264257
workflows_manager,
265258
async_client: AsyncClientFixture,

cylc/uiserver/tests/test_workflows_mgr_data_store.py

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def sync_capture(func, *_):
5454
return uis
5555

5656

57-
@pytest.mark.asyncio
5857
@pytest.mark.parametrize(
5958
'before,after,actions',
6059
[

pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ build-backend = "setuptools.build_meta"
1010
addopts = """
1111
--doctest-modules
1212
--doctest-continue-on-failure
13+
-p no:asyncio
1314
"""
15+
# Note: disabled pytest-asyncio to avoid conflict with pytest-tornasync
16+
# The latter should be capable of running the async tests anyway
1417
doctest_optionflags = """
1518
NORMALIZE_WHITESPACE
1619
IGNORE_EXCEPTION_DETAIL

setup.cfg

-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ tests =
9090
flake8-simplify>=0.14.0
9191
flake8>=3.0.0
9292
mypy>=0.900
93-
pytest-asyncio>=0.14.0
9493
pytest-cov>=2.8.0
9594
pytest-tornasync>=0.5.0
9695
pytest>=6

0 commit comments

Comments
 (0)