Initial code commit
CI / test (3.11) (push) Canceled after 0s
CI / test (3.12) (push) Canceled after 0s
CI / test (3.13) (push) Canceled after 0s
CI / test (3.14) (push) Canceled after 0s
CI / package (push) Canceled after 0s
CI / precommit-and-security (push) Canceled after 11s
CI / typecheck (push) Canceled after 11s
CI / test (3.11) (push) Canceled after 0s
CI / test (3.12) (push) Canceled after 0s
CI / test (3.13) (push) Canceled after 0s
CI / test (3.14) (push) Canceled after 0s
CI / package (push) Canceled after 0s
CI / precommit-and-security (push) Canceled after 11s
CI / typecheck (push) Canceled after 11s
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import io
|
||||
|
||||
import pytest
|
||||
|
||||
from schedls.errors import InvalidScheduleError
|
||||
from schedls.operations.calendar import run_calendar
|
||||
from schedls.output import Output
|
||||
from schedls.runner import CommandRunner
|
||||
|
||||
pytestmark = pytest.mark.integration
|
||||
|
||||
|
||||
def _has_analyze() -> bool:
|
||||
return CommandRunner().has("systemd-analyze")
|
||||
|
||||
|
||||
def test_calendar_valid() -> None:
|
||||
if not _has_analyze():
|
||||
pytest.skip("systemd-analyze not available")
|
||||
stream = io.StringIO()
|
||||
output = Output(color="never", stdout=stream)
|
||||
run_calendar(CommandRunner(), output, "Mon..Fri 02:30", next_count=3)
|
||||
text = stream.getvalue()
|
||||
assert "Normalized" in text
|
||||
assert "Mon..Fri *-*-* 02:30:00" in text
|
||||
|
||||
|
||||
def test_calendar_invalid() -> None:
|
||||
if not _has_analyze():
|
||||
pytest.skip("systemd-analyze not available")
|
||||
stream = io.StringIO()
|
||||
output = Output(color="never", stdout=stream)
|
||||
with pytest.raises(InvalidScheduleError):
|
||||
run_calendar(CommandRunner(), output, "definitely not a calendar", next_count=1)
|
||||
Reference in New Issue
Block a user