Skip to content

Commit e46a67a

Browse files
committed
Fix lint in tests
1 parent f64132c commit e46a67a

File tree

10 files changed

+54
-50
lines changed

10 files changed

+54
-50
lines changed

tests/integration/conftest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,8 +757,6 @@ def fake_submit(self, _workflow, itasks, *_):
757757
'cylc.flow.task_job_mgr.TaskJobManager.submit_livelike_task_jobs',
758758
fake_submit)
759759

760-
761-
762760
def get_submissions():
763761
return {
764762
itask.identity

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/test_data_store_mgr.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
WORKFLOW,
3737
)
3838
from cylc.flow.id import Tokens
39+
from cylc.flow.scheduler import Scheduler
3940
from cylc.flow.task_events_mgr import TaskEventsManager
4041
from cylc.flow.task_outputs import (
4142
TASK_OUTPUT_STARTED,

tests/integration/test_platforms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async def test_prep_submit_task_tries_multiple_platforms(
2323
task platform setting matches a group, and that after all platforms
2424
have been tried that the hosts matching that platform group are
2525
cleared.
26-
26+
2727
See https://github.com/cylc/cylc-flow/pull/6109
2828
"""
2929
global_conf = '''

tests/integration/test_task_pool.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
)
4343

4444
from cylc.flow.flow_mgr import FLOW_ALL, FLOW_NONE
45+
from cylc.flow.task_proxy import TaskProxy
4546
from cylc.flow.task_state import (
4647
TASK_STATUS_WAITING,
4748
TASK_STATUS_PREPARING,
@@ -1255,7 +1256,7 @@ async def test_set_failed_complete(
12551256
"""Test manual completion of an incomplete failed task."""
12561257
id_ = flow(one_conf)
12571258
schd = scheduler(id_)
1258-
async with start(schd, level=logging.DEBUG) as log:
1259+
async with start(schd, level=logging.DEBUG):
12591260
one = schd.pool.get_tasks()[0]
12601261
one.state_reset(is_queued=False)
12611262

@@ -1312,7 +1313,7 @@ async def test_set_prereqs(
13121313
)
13131314
schd = scheduler(id_)
13141315

1315-
async with start(schd) as log:
1316+
async with start(schd):
13161317

13171318
# it should start up with foo, bar, baz
13181319
assert (
@@ -1392,7 +1393,7 @@ def set_prereqs(prereqs):
13921393
schd.pool.set_prereqs_and_outputs(
13931394
["2040/bar"], None, prereqs, ['all'])
13941395

1395-
async with start(schd) as log:
1396+
async with start(schd):
13961397
# Invalid: task name wildcard:
13971398
set_prereqs(["2040/*"])
13981399
assert log_filter(contains='Invalid prerequisite task name')
@@ -1434,7 +1435,7 @@ async def test_set_outputs_live(
14341435
)
14351436
schd = scheduler(id_)
14361437

1437-
async with start(schd) as log:
1438+
async with start(schd):
14381439

14391440
# it should start up with just 1/foo
14401441
assert pool_get_task_ids(schd.pool) == ["1/foo"]

tests/integration/test_workflow_events.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,6 @@ def mock_run_event_handlers(self, event, reason=""):
228228
await asyncio.sleep(0.1)
229229

230230
assert (
231-
"[('workflow-event-handler-00', 'shutdown') err] killed on timeout (PT1S)"
232-
in caplog.text
233-
)
231+
"[('workflow-event-handler-00', 'shutdown') err] killed on "
232+
"timeout (PT1S)"
233+
) in caplog.text

tests/unit/conftest.py

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,31 @@
1717
"""Standard pytest fixtures for unit tests."""
1818

1919
from pathlib import Path
20-
from typing import Any, Callable, Optional, Union
21-
from unittest.mock import create_autospec, Mock
20+
from typing import (
21+
Any,
22+
Callable,
23+
Optional,
24+
Union,
25+
)
26+
from unittest.mock import (
27+
Mock,
28+
create_autospec,
29+
)
2230

2331
import pytest
2432

2533
from cylc.flow.cycling.iso8601 import init as iso8601_init
2634
from cylc.flow.cycling.loader import (
35+
INTEGER_CYCLING_TYPE,
2736
ISO8601_CYCLING_TYPE,
28-
INTEGER_CYCLING_TYPE
2937
)
3038
from cylc.flow.data_store_mgr import DataStoreMgr
3139
from cylc.flow.install import (
3240
link_runN,
3341
unlink_runN,
3442
)
3543
from cylc.flow.scheduler import Scheduler
36-
from cylc.flow.workflow_files import (
37-
WorkflowFiles,
38-
)
44+
from cylc.flow.workflow_files import WorkflowFiles
3945
from cylc.flow.xtrigger_mgr import XtriggerManager
4046

4147

@@ -219,3 +225,28 @@ def prevent_symlinking(monkeypatch: pytest.MonkeyPatch):
219225
'cylc.flow.pathutil.make_symlink_dir',
220226
lambda *_, **__: {}
221227
)
228+
229+
230+
def _tmp_flow_config(tmp_run_dir: Callable):
231+
"""Create a temporary flow config file for use in init'ing WorkflowConfig.
232+
Args:
233+
id_: Workflow name.
234+
config: The flow file content.
235+
Returns the path to the flow file.
236+
"""
237+
def __tmp_flow_config(id_: str, config: str) -> 'Path':
238+
run_dir: 'Path' = tmp_run_dir(id_)
239+
flow_file = run_dir / WorkflowFiles.FLOW_FILE
240+
flow_file.write_text(config)
241+
return flow_file
242+
return __tmp_flow_config
243+
244+
245+
@pytest.fixture
246+
def tmp_flow_config(tmp_run_dir: Callable):
247+
return _tmp_flow_config(tmp_run_dir)
248+
249+
250+
@pytest.fixture(scope='module')
251+
def mod_tmp_flow_config(mod_tmp_run_dir: Callable):
252+
return _tmp_flow_config(mod_tmp_run_dir)

tests/unit/test_config.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -56,31 +56,6 @@
5656
Fixture = Any
5757

5858

59-
def _tmp_flow_config(tmp_run_dir: Callable):
60-
"""Create a temporary flow config file for use in init'ing WorkflowConfig.
61-
Args:
62-
id_: Workflow name.
63-
config: The flow file content.
64-
Returns the path to the flow file.
65-
"""
66-
def __tmp_flow_config(id_: str, config: str) -> 'Path':
67-
run_dir: 'Path' = tmp_run_dir(id_)
68-
flow_file = run_dir / WorkflowFiles.FLOW_FILE
69-
flow_file.write_text(config)
70-
return flow_file
71-
return __tmp_flow_config
72-
73-
74-
@pytest.fixture
75-
def tmp_flow_config(tmp_run_dir: Callable):
76-
return _tmp_flow_config(tmp_run_dir)
77-
78-
79-
@pytest.fixture(scope='module')
80-
def mod_tmp_flow_config(mod_tmp_run_dir: Callable):
81-
return _tmp_flow_config(mod_tmp_run_dir)
82-
83-
8459
class TestWorkflowConfig:
8560
"""Test class for the Cylc WorkflowConfig object."""
8661

tests/unit/test_task_outputs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,9 @@ def test_iter_required_outputs():
281281
{TASK_OUTPUT_EXPIRED}, # task may expire
282282
)
283283
)
284-
assert outputs._completion_expression == '(succeeded and x and y) or expired'
284+
assert outputs._completion_expression == (
285+
'(succeeded and x and y) or expired'
286+
)
285287
assert set(outputs.iter_required_messages()) == {
286288
TASK_OUTPUT_SUCCEEDED,
287289
'x',

tests/unit/test_taskdef.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,12 @@
1515
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

1717
from cylc.flow.config import WorkflowConfig
18-
from cylc.flow.taskdef import generate_graph_parents
19-
from cylc.flow.cycling.iso8601 import ISO8601Point
2018
from cylc.flow.cycling.integer import IntegerPoint
19+
from cylc.flow.cycling.iso8601 import ISO8601Point
20+
from cylc.flow.taskdef import generate_graph_parents
2121

2222

23-
from .test_config import tmp_flow_config # noqa: F401
24-
25-
26-
def test_generate_graph_parents_1(tmp_flow_config): # noqa: F811
23+
def test_generate_graph_parents_1(tmp_flow_config):
2724
"""Test that parents are only generated from valid recurrences."""
2825
id_ = 'pan-galactic'
2926
flow_file = tmp_flow_config(
@@ -64,7 +61,7 @@ def test_generate_graph_parents_1(tmp_flow_config): # noqa: F811
6461
]
6562

6663

67-
def test_generate_graph_parents_2(tmp_flow_config): # noqa: F811
64+
def test_generate_graph_parents_2(tmp_flow_config):
6865
"""Test inferred parents are valid w.r.t to their own recurrences."""
6966
id_ = 'gargle-blaster'
7067
flow_file = tmp_flow_config(

0 commit comments

Comments
 (0)