Code cleanup, hardening, and test coverage improvements#913
Open
sreckoskocilic wants to merge 7 commits into
Open
Code cleanup, hardening, and test coverage improvements#913sreckoskocilic wants to merge 7 commits into
sreckoskocilic wants to merge 7 commits into
Conversation
…paring two tuples, every equality check returns True - master -> main branch fix - prepare_trash now calls self.move_to_trash instead of self.delete, so plugin subclasses won't permanently delete files when the user expects trashing - NotImplementedError - unrecognized platforms fail fast with a clear message instead of a cryptic NameError - removed shadowing basename import - get_column_widths uses range so plugin-added columns get their widths saved/restored
…it__ always runs, even on exception. - util/qt/__init__.py — Added missing c_void_p import from ctypes, fixing a macOS runtime crash. - table.py — Fixed off-by-one: bounds check now rejects len + 1 correctly. - widgets.py — Added null guard on _main_window before accessing it in state change handler.
…ved, so a/b/c/../../d correctly becomes a/d. - session.py — Removed dead _get_startup_message method (duplicated by _show_startup_messages)
…r _files dict, snapshot_files for safe iteration - model/table.py — Lock guards on Rows.__len__/__getitem__/__iter__/index, assert → raise - model/worker.py — task_done on shutdown sentinel, join guard for inactive thread - metrics.py — silent pass → logging.debug, SENTINEL-based shutdown for AsynchronousMetrics - plugins/config.py — bare except comments → logging, type() == → isinstance() - controller.py — file_path → file_url rename, removed assert on context menu reason - onboarding/tutorial.py — assert → raise ValueError with context - usage_helper.py — assert → early return on empty events - quicksearch.py — guard against zero row_height - single_row_mode.py — null guard before remove_delegate - cursor_movement.py — pass toggle_selection through page up/down - util/path.py — normalize handles chained .. and /.. at root - core/__init__.py — widen numeric sort padding from 6 to 20 digits - explorer_properties.py — try/finally for menu handle cleanup - key_event.py — OS X → macOS, updated Qt doc link - test_quicksearch_matchers.py — added ContainsCharsTest and ContainsSubstringTest - test_resize_cols_to_contents.py — added shrink cap tests, DistributeEvenlyTest, DistributeExponentiallyTest - test_model.py — added ModelFilesCopyTest for concurrent dict.copy safety - test_plugin.py — added ReportExceptions tests (exception_stored, exclude_must_be_set) - test_path.py — added normalize tests for chained .. and /.. at root - test_worker.py — new: WorkerTest (6 tests) + WorkItemTest (4 tests) - test_error.py — new: FormatTracebackTest, WalkTbWithFilteringTest, TracebackExceptionWithTbFilterTest, PluginErrorHandlerTest
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.
Summary
Hardening (assert → raise, guards, logging)
model/model.py—assert→raise RuntimeError/ValueError;Event-based shutdown flag;Lockfor_filesdict;_snapshot_files()for safe cross-thread iteration; early return in_record_fileswhen shutdown;_on_empty_rows_initedruns callback via@run_in_main_thread;_commit_sort_updates_and_sortmoves sort value writes to main threadmodel/table.py—Lockguards onRows.__len__,__getitem__,__iter__,index;assert→raise RuntimeErrormodel/worker.py—task_done()on shutdown sentinel;join()guarded byis_alive()checkonboarding/tutorial.py— 3assert→raise ValueErrorwith context messagesusage_helper.py—assert events→ earlyreturn Falseon empty events listsingle_row_mode.py— null guard beforeremove_delegatequicksearch.py— guard againstrow_height <= 0onboarding/__init__.py— unclosed</ul>tag fixSilent failures → logging
metrics.py— barepassintrack()/update_user()→_LOG.debug()withexc_info;SENTINEL-based shutdown forAsynchronousMetricsthreadplugins/config.py— inline comments explaining swallowed exceptions →_LOG.debug()/_LOG.warning()withexc_infoplugins/error.py— docstring forreport()excparameterBug fixes
controller.py—file_path→file_urlparameter rename for consistencycursor_movement.py—toggle_selectionnow passed through inmove_cursor_page_up/page_downutil/path.py—normalizehandles chained..segments and/..at rootcore/__init__.py— numeric sort padding widened from 6 to 20 digits (supports numbers up to 10^20)plugins/config.py—type() ==→isinstance()for proper subclass handlingCleanup
controller.py— removedassertonQContextMenuEvent.reason()explorer_properties.py—try/finallyensuresDestroyMenu(hMenu)cleanup on Windowskey_event.py— "OS X" → "macOS"; updated Qt doc URL to archived 5.15 docsNew tests (39 tests added)
test_worker.py(new) —WorkerTest(6 tests): priority ordering, shutdown, submit-after-shutdown, exception resilience.WorkItemTest(4 tests): shutdown detection, ordering, exception capturetest_error.py(new) —FormatTracebackTest(3),WalkTbWithFilteringTest(3),TracebackExceptionWithTbFilterTest(5),PluginErrorHandlerTest(4): traceback filtering, chained exceptions, pending error queuingtest_resize_cols_to_contents.py— 2 newResizeColumnTestmethods (shrink width cap),DistributeEvenlyTest(4),DistributeExponentiallyTest(4)test_model.py—ModelFilesCopyTest: concurrentdict.copy()safety under mutationtest_plugin.py—ReportExceptionstests:exception_stored,exclude_must_be_settest_path.py—normalizetests for chained..and/..at roottest_quicksearch_matchers.py—ContainsCharsTest(6) andContainsSubstringTest(4)Test plan
..segments