swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7ff6caf88cc0>
def test_list_tasks(swh_scheduler):
task1 = create_task_dict("swh-test-ping", "oneshot", key="value1")
task2 = create_task_dict("swh-test-ping", "oneshot", key="value2")
task1["next_run"] += datetime.timedelta(days=3, hours=2)
swh_scheduler.create_tasks([task1, task2])
swh_scheduler.grab_ready_tasks("swh-test-ping")
result = invoke(swh_scheduler, False, ["task", "list",])
expected = r"""
Found 2 tasks
Task 1
Next run: .+ \(.*\)
Interval: 1 day, 0:00:00
Type: swh-test-ping
Policy: oneshot
Status: next_run_not_scheduled
Priority:\x20
Args:
Keyword args:
key: 'value1'
Task 2
Next run: today \(.*\)
Interval: 1 day, 0:00:00
Type: swh-test-ping
Policy: oneshot
Status: next_run_scheduled
Priority:\x20
Args:
Keyword args:
key: 'value2'
""".lstrip()
assert result.exit_code == 0, result.output
> assert re.fullmatch(expected, result.output, re.MULTILINE), result.output
E AssertionError: Found 2 tasks
E
E Task 2
E Next run: today (2021-02-09T14:06:35.942240+00:00)
E Interval: 1 day, 0:00:00
E Type: swh-test-ping
E Policy: oneshot
E Status: next_run_scheduled
E Priority:
E Args:
E Keyword args:
E key: 'value2'
E
E Task 1
E Next run: Feb 12 (2021-02-12T16:06:35.942223+00:00)
E Interval: 1 day, 0:00:00
E Type: swh-test-ping
E Policy: oneshot
E Status: next_run_not_scheduled
E Priority:
E Args:
E Keyword args:
E key: 'value1'
E
E
E assert None
E + where None = <function fullmatch at 0x7ff6d1db5488>("Found 2 tasks\n\nTask 1\n Next run: .+ \\(.*\\)\n Interval: 1 day, 0:00:00\n Type: swh-test-ping\n Policy: onesho...ng\n Policy: oneshot\n Status: next_run_scheduled\n Priority:\\x20\n Args:\n Keyword args:\n key: 'value2'\n\n", "Found 2 tasks\n\nTask 2\n Next run: today (2021-02-09T14:06:35.942240+00:00)\n Interval: 1 day, 0:00:00\n Type: sw...ng\n Policy: oneshot\n Status: next_run_not_scheduled\n Priority: \n Args:\n Keyword args:\n key: 'value1'\n\n", <RegexFlag.MULTILINE: 8>)
E + where <function fullmatch at 0x7ff6d1db5488> = re.fullmatch
E + and "Found 2 tasks\n\nTask 2\n Next run: today (2021-02-09T14:06:35.942240+00:00)\n Interval: 1 day, 0:00:00\n Type: sw...ng\n Policy: oneshot\n Status: next_run_not_scheduled\n Priority: \n Args:\n Keyword args:\n key: 'value1'\n\n" = <Result okay>.output
E + and <RegexFlag.MULTILINE: 8> = re.MULTILINE
.tox/py3/lib/python3.7/site-packages/swh/scheduler/tests/test_cli.py:368: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 9 2021, 3:07 PM