swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7ff6cb37b898>
def test_list_tasks_limit(swh_scheduler):
task1 = create_task_dict("swh-test-ping", "oneshot", key="value1")
task2 = create_task_dict("swh-test-ping", "oneshot", key="value2")
task3 = create_task_dict("swh-test-ping", "oneshot", key="value3")
swh_scheduler.create_tasks([task1, task2, task3])
result = invoke(swh_scheduler, False, ["task", "list", "--limit", "2",])
expected = r"""
Found 2 tasks
Task 1
Next run: today \(.*\)
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_not_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 3
E Next run: today (2021-02-09T14:06:36.145718+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: 'value3'
E
E Task 2
E Next run: today (2021-02-09T14:06:36.145713+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: 'value2'
E
E
E assert None
E + where None = <function fullmatch at 0x7ff6d1db5488>("Found 2 tasks\n\nTask 1\n Next run: today \\(.*\\)\n Interval: 1 day, 0:00:00\n Type: swh-test-ping\n Policy: one... Policy: oneshot\n Status: next_run_not_scheduled\n Priority:\\x20\n Args:\n Keyword args:\n key: 'value2'\n\n", "Found 2 tasks\n\nTask 3\n Next run: today (2021-02-09T14:06:36.145718+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: 'value2'\n\n", <RegexFlag.MULTILINE: 8>)
E + where <function fullmatch at 0x7ff6d1db5488> = re.fullmatch
E + and "Found 2 tasks\n\nTask 3\n Next run: today (2021-02-09T14:06:36.145718+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: 'value2'\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:513: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 9 2021, 3:07 PM