Aller au contenu
login
arrow_backRetour aux issues
HafidIdrissi/Time-Tracker #24

Add timezone and duration-boundary tests for SQLite persistence

ecoDébutant enhancement help wanted good first issue

descriptionDescription

## User problem The database stores timezone-aware timestamps in UTC and clamps an end time that would precede its period start. These guarantees protect activity durations, but they are not covered directly by unit tests. ## Expected result Add focused database tests that document UTC serialization and non-negative duration behavior. Keep the database schema unchanged unless a test exposes a small defect. ## Likely files - `tests/test_database.py` - `timetracker/database.py` only if justified by a failing test ## Acceptance criteria - Verify that `to_utc()` rejects a naive `datetime`. - Verify that a non-UTC aware timestamp is normalized to UTC. - Verify that `to_storage()` emits a timezone-qualified value with millisecond precision. - Verify that updating a period with an end before its start stores a zero duration and does not move the end before the start. - Verify that the idle flag and Unicode application/title values survive a database round trip. - Use a temporary database and leave no generated `activity.db` in the repo. ## Test command ```powershell python -m unittest tests.test_database -v python -m unittest discover -v ```
codeOuvre sur GitHub