ci: add pre-commit and tests workflows
All checks were successful
checks / pre-commit (push) Successful in 1m39s
checks / tests-10 (push) Successful in 1m17s
checks / tests-11 (push) Successful in 1m10s
checks / tests-12 (push) Successful in 1m13s

This commit is contained in:
cătălin 2024-08-04 15:23:55 +02:00
commit bdb5c984fa
No known key found for this signature in database
13 changed files with 339 additions and 297 deletions

View file

@ -1,6 +1,5 @@
from pathlib import Path
import pendulum
import pytest as pytest
from halig import utils
@ -24,10 +23,10 @@ def notes(notebooks_path: Path):
dailies = work / "Dailies"
dailies.mkdir()
dt = pendulum.now()
dt = utils.now()
for day_offset in range(10):
dt = dt.subtract(days=day_offset)
(dailies / f"{dt.date()}.age").touch()
dt = dt.subtract(hours=day_offset*24)
(dailies / f"{dt.py_datetime().date()}.age").touch()
@pytest.fixture()
@ -56,7 +55,7 @@ def notebooks_command(settings: Settings):
@pytest.fixture()
def current_note(notes, settings, encryptor) -> Path:
note_path = settings.notebooks_root_path / f"{utils.now().date()}.age"
note_path = settings.notebooks_root_path / f"{utils.now_as_date()}.age"
note_path.touch()
data = encryptor.encrypt(b"foo")
with note_path.open("wb") as f:
@ -67,7 +66,7 @@ def current_note(notes, settings, encryptor) -> Path:
@pytest.fixture()
def current_daily(notes, settings, encryptor) -> Path:
note_path = (
settings.notebooks_root_path / "Work" / "Dailies" / f"{utils.now().date()}.age"
settings.notebooks_root_path / "Work" / "Dailies" / f"{utils.now_as_date()}.age"
)
data = encryptor.encrypt(b"foo")
with note_path.open("wb") as f: