* Make reminders be its own dataset rather than tied to current string. * Add support for repeated reminders * Make reminders be a feature that can be turned on and off * Add syntax highlighting for code blocks (right-click to set it) * Add a Pomodoro-style timer for measuring time spent on a task (stopping the timer offers to log it to Time Log) * Add ability to create markdown tables. Right-click to edit the table in a friendlier table dialog
60 lines
1.3 KiB
Python
60 lines
1.3 KiB
Python
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
from PySide6.QtWidgets import QApplication
|
|
|
|
# Ensure the nested package directory (repo_root/bouquin) is on sys.path
|
|
PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
|
PKG_PARENT = PROJECT_ROOT / "bouquin"
|
|
if str(PKG_PARENT) not in sys.path:
|
|
sys.path.insert(0, str(PKG_PARENT))
|
|
|
|
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def app():
|
|
app = QApplication.instance()
|
|
if app is None:
|
|
app = QApplication([])
|
|
return app
|
|
|
|
|
|
@pytest.fixture(scope="session", autouse=True)
|
|
def isolate_qsettings(tmp_path_factory):
|
|
cfgdir = tmp_path_factory.mktemp("qt_cfg")
|
|
os.environ["XDG_CONFIG_HOME"] = str(cfgdir)
|
|
yield
|
|
|
|
|
|
@pytest.fixture
|
|
def tmp_db_cfg(tmp_path):
|
|
from bouquin.db import DBConfig
|
|
|
|
default_db = tmp_path / "notebook.db"
|
|
key = "test-secret-key"
|
|
return DBConfig(
|
|
path=default_db,
|
|
key=key,
|
|
idle_minutes=0,
|
|
theme="light",
|
|
move_todos=True,
|
|
tags=True,
|
|
time_log=True,
|
|
reminders=True,
|
|
locale="en",
|
|
font_size=11,
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def fresh_db(tmp_db_cfg):
|
|
from bouquin.db import DBManager
|
|
|
|
db = DBManager(tmp_db_cfg)
|
|
ok = db.connect()
|
|
assert ok, "DB connect() should succeed"
|
|
yield db
|
|
db.close()
|