Skip to content

Commit c91d352

Browse files
authored
Merge pull request #6703 from MetRonnie/flake8
Cherry pick #6629 - use Flake8 on tests
2 parents 1876f34 + e46a67a commit c91d352

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+438
-286
lines changed

tests/integration/conftest.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,11 @@ def _submit_task_jobs(*args, **kwargs):
570570
deps = tuple(sorted(itask.state.get_resolved_dependencies()))
571571
if flow_nums:
572572
triggers.add(
573-
(itask.identity, serialise_set(itask.flow_nums), deps or None)
573+
(
574+
itask.identity,
575+
serialise_set(itask.flow_nums),
576+
deps or None,
577+
)
574578
)
575579
else:
576580
triggers.add((itask.identity, deps or None))
@@ -753,8 +757,6 @@ def fake_submit(self, _workflow, itasks, *_):
753757
'cylc.flow.task_job_mgr.TaskJobManager.submit_livelike_task_jobs',
754758
fake_submit)
755759

756-
757-
758760
def get_submissions():
759761
return {
760762
itask.identity

tests/integration/events/test_task_events.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ async def test_event_email_body(
8484
ctx = SimpleNamespace(mail_to=None, mail_from=None)
8585
async with start(mod_one):
8686
# send a custom task message with the warning severity level
87-
id_keys = [EventKey('none', 'warning', 'warning message', Tokens('//1/a/01'))]
87+
id_keys = [
88+
EventKey('none', 'warning', 'warning message', Tokens('//1/a/01'))
89+
]
8890
mod_one.task_events_mgr._process_event_email(mod_one, ctx, id_keys)
8991

9092
# test the email which would have been sent for this message

tests/integration/network/test_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ async def test_command_validation_failure(harness):
9999
pytest.param({'error': 'message'}, r"^message$", id="basic"),
100100
pytest.param(
101101
{'foo': 1},
102-
r"^Received invalid response for Cylc 8\.[\w.]+: \{'foo': 1[^}]*\}$",
102+
r"^Received invalid response for"
103+
r" Cylc 8\.[\w.]+: \{'foo': 1[^}]*\}$",
103104
id="no-err-field",
104105
),
105106
pytest.param(

tests/integration/network/test_publisher.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# You should have received a copy of the GNU General Public License
1515
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
from async_timeout import timeout
17-
import pytest
1817

1918
from cylc.flow.network.subscriber import (
2019
WorkflowSubscriber,

tests/integration/network/test_server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ def _api(*args, **kwargs):
125125
),
126126
pytest.param(
127127
{'user': 'bono', 'args': {}},
128-
f"Request missing field 'command' required for Cylc {CYLC_VERSION}",
128+
"Request missing field 'command' required for"
129+
f" Cylc {CYLC_VERSION}",
129130
id='missing-command',
130131
),
131132
pytest.param(

tests/integration/reftests/test_cyclers.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,15 @@ async def test_icp_fcp_notation(flow, scheduler, reftest):
9999
('20160101T0000Z/bar', None),
100100
('20160101T0100Z/baz', None),
101101
('20160101T2300Z/boo', None),
102-
('20160102T0000Z/bot', ('20160101T0000Z/bar', '20160101T0000Z/foo', '20160101T0100Z/baz', '20160101T2300Z/boo')),
102+
(
103+
'20160102T0000Z/bot',
104+
(
105+
'20160101T0000Z/bar',
106+
'20160101T0000Z/foo',
107+
'20160101T0100Z/baz',
108+
'20160101T2300Z/boo',
109+
),
110+
),
103111
}
104112

105113

tests/integration/reftests/test_pre_initial.py

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,49 @@ async def test_advanced(flow, scheduler, reftest):
5151
assert await reftest(schd) == {
5252
('20100101T0000Z/b', None),
5353
('20100101T0600Z/b', None),
54-
('20100101T0000Z/a', ('20091231T1800Z/a', '20091231T1800Z/c', '20100101T0000Z/b')),
55-
('20100101T0000Z/c', ('20091231T1800Z/a', '20091231T1800Z/c', '20100101T0000Z/b')),
54+
(
55+
'20100101T0000Z/a',
56+
('20091231T1800Z/a', '20091231T1800Z/c', '20100101T0000Z/b'),
57+
),
58+
(
59+
'20100101T0000Z/c',
60+
('20091231T1800Z/a', '20091231T1800Z/c', '20100101T0000Z/b'),
61+
),
5662
('20100101T1200Z/b', None),
57-
('20100101T0600Z/a', ('20100101T0000Z/a', '20100101T0000Z/c', '20100101T0600Z/b')),
58-
('20100101T0600Z/c', ('20100101T0000Z/a', '20100101T0000Z/c', '20100101T0600Z/b')),
63+
(
64+
'20100101T0600Z/a',
65+
('20100101T0000Z/a', '20100101T0000Z/c', '20100101T0600Z/b'),
66+
),
67+
(
68+
'20100101T0600Z/c',
69+
('20100101T0000Z/a', '20100101T0000Z/c', '20100101T0600Z/b'),
70+
),
5971
('20100101T1800Z/b', None),
60-
('20100101T1200Z/a', ('20100101T0600Z/a', '20100101T0600Z/c', '20100101T1200Z/b')),
61-
('20100101T1200Z/c', ('20100101T0600Z/a', '20100101T0600Z/c', '20100101T1200Z/b')),
72+
(
73+
'20100101T1200Z/a',
74+
('20100101T0600Z/a', '20100101T0600Z/c', '20100101T1200Z/b'),
75+
),
76+
(
77+
'20100101T1200Z/c',
78+
('20100101T0600Z/a', '20100101T0600Z/c', '20100101T1200Z/b'),
79+
),
6280
('20100102T0000Z/b', None),
63-
('20100101T1800Z/c', ('20100101T1200Z/a', '20100101T1200Z/c', '20100101T1800Z/b')),
64-
('20100101T1800Z/a', ('20100101T1200Z/a', '20100101T1200Z/c', '20100101T1800Z/b')),
65-
('20100102T0000Z/a', ('20100101T1800Z/a', '20100101T1800Z/c', '20100102T0000Z/b')),
66-
('20100102T0000Z/c', ('20100101T1800Z/a', '20100101T1800Z/c', '20100102T0000Z/b')),
81+
(
82+
'20100101T1800Z/c',
83+
('20100101T1200Z/a', '20100101T1200Z/c', '20100101T1800Z/b'),
84+
),
85+
(
86+
'20100101T1800Z/a',
87+
('20100101T1200Z/a', '20100101T1200Z/c', '20100101T1800Z/b'),
88+
),
89+
(
90+
'20100102T0000Z/a',
91+
('20100101T1800Z/a', '20100101T1800Z/c', '20100102T0000Z/b'),
92+
),
93+
(
94+
'20100102T0000Z/c',
95+
('20100101T1800Z/a', '20100101T1800Z/c', '20100102T0000Z/b'),
96+
),
6797
}
6898

6999

@@ -113,7 +143,10 @@ async def test_over_bracketed(flow, scheduler, reftest, validate):
113143

114144
assert await reftest(schd) == {
115145
('20131225T1200Z/c', None),
116-
('20131225T1200Z/d', ('20131224T1200Z/a', '20131224T1200Z/b', '20131224T1200Z/c')),
146+
(
147+
'20131225T1200Z/d',
148+
('20131224T1200Z/a', '20131224T1200Z/b', '20131224T1200Z/c'),
149+
),
117150
('20131225T1200Z/a', None),
118151
('20131225T1200Z/b', None),
119152
}

tests/integration/run_modes/test_nonlive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def _inner(schd):
7676

7777
# Check that timestamps have been created:
7878
for timestamp in [
79-
'time_submit', 'time_submit_exit', 'time_run', 'time_run_exit'
79+
'time_submit', 'time_submit_exit', 'time_run', 'time_run_exit'
8080
]:
8181
assert task_jobs[timestamp] is not None
8282
return _inner

tests/integration/run_modes/test_simulation.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,20 @@ async def test_started_trigger(flow, reftest, scheduler):
3333
Long standing Bug discovered in Skip Mode work.
3434
https://github.com/cylc/cylc-flow/pull/6039#issuecomment-2321147445
3535
"""
36-
schd = scheduler(flow({
37-
'scheduler': {'events': {'stall timeout': 'PT0S', 'abort on stall timeout': True}},
38-
'scheduling': {'graph': {'R1': 'a:started => b'}}
39-
}), paused_start=False)
36+
schd = scheduler(
37+
flow(
38+
{
39+
'scheduler': {
40+
'events': {
41+
'stall timeout': 'PT0S',
42+
'abort on stall timeout': True,
43+
}
44+
},
45+
'scheduling': {'graph': {'R1': 'a:started => b'}},
46+
}
47+
),
48+
paused_start=False,
49+
)
4050
assert await reftest(schd) == {
4151
('1/a', None),
4252
('1/b', ('1/a',))
@@ -285,7 +295,7 @@ async def test_settings_restart(monkeytime, flow, scheduler, start):
285295

286296
# Stop and restart the scheduler:
287297
schd = scheduler(id_)
288-
async with start(schd) as log:
298+
async with start(schd):
289299
for itask in schd.pool.get_tasks():
290300
# Check that we haven't got mode settings back:
291301
assert itask.mode_settings is None
@@ -300,10 +310,8 @@ async def test_settings_restart(monkeytime, flow, scheduler, start):
300310
)
301311
schd.workflow_db_mgr.process_queued_ops()
302312
monkeytime(42)
303-
expected_timeout = 102.0
304313
else:
305314
monkeytime(og_timeouts[itask.identity] - 1)
306-
expected_timeout = float(int(og_timeouts[itask.identity]))
307315

308316
assert sim_time_check(
309317
schd.task_events_mgr, [itask], schd.workflow_db_mgr

tests/integration/run_modes/test_skip.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,11 @@ async def test_prereqs_marked_satisfied_by_skip_mode(
216216
assert satisfied_message == 'satisfied by skip mode'
217217

218218

219-
async def test_outputs_can_be_changed(one_conf, flow, start, scheduler, validate):
220-
219+
async def test_outputs_can_be_changed(
220+
one_conf, flow, start, scheduler, validate
221+
):
221222
schd = scheduler(flow(one_conf), run_mode='live')
222-
async with start(schd) as log:
223+
async with start(schd):
223224
# Broadcast the task into skip mode, output failed and submit it:
224225
schd.broadcast_mgr.put_broadcast(
225226
["1"],

0 commit comments

Comments
 (0)