Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
track.mainhandledRuntimeErrorandValueError, but a database that cannot be opened (for example, a path that is a directory) raisedsqlite3.OperationalErrorand printed an uncaught traceback.Change
sqlite3.ErrorfromActivityDatabase(...)) are logged as one line and return exit status 1.ActivityDatabasealready closes its connection when construction fails.sqlite3.Errorraised while tracking is logged as one line and returns 1.OSErroris not caught anywhere else, so unrelated OS errors keep their tracebacks.ActivityTracker.run(), which logs "Tracker started", so a failed open never prints a start message.test_database_failure_logs_a_concise_error_and_exits_nonzeronow points--databaseat a temporary directory, so a real SQLite open fails instead of a mock. It asserts exit 1, the one-line error, and that the tracker is never constructed.Testing
.venv/bin/python -m unittest tests.test_track_cli.TrackCliTests.test_database_failure_logs_a_concise_error_and_exits_nonzero: passes on this change.git show ccbfbc4:track.py > track.py(basetrack.py, updated test): fails withsqlite3.OperationalError: unable to open database file..venv/bin/python -m unittest discover: OK (skipped=7).CI was not run.
Regression test: fails on base twice (/sqlite3.OperationalError: unable to open database file/), passes on fix twice (
.venv/bin/python -m unittest tests.test_track_cli.TrackCliTests.test_database_failure_logs_a_concise_error_and_exits_nonzero)Fixes #127