From 16c8f81a5ad5aa4f7f89669e2062e390be0df667 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Mon, 1 Jun 2026 12:24:57 -0700 Subject: [PATCH] Attempted CI test fixes. Also spelling. --- borgmatic/actions/browse/directory_list.py | 10 +++++----- borgmatic/actions/browse/logs.py | 2 +- borgmatic/actions/browse/repositories_list.py | 4 ++-- borgmatic/borg/borg.py | 2 +- borgmatic/commands/borgmatic.py | 4 ++-- borgmatic/logger.py | 2 +- pyproject.toml | 3 +++ tests/end-to-end/hooks/credential/test_container.py | 2 +- tests/end-to-end/hooks/credential/test_file.py | 2 +- tests/end-to-end/hooks/credential/test_keepassxc.py | 2 +- tests/end-to-end/hooks/credential/test_systemd.py | 2 +- tests/end-to-end/hooks/data_source/test_btrfs.py | 2 +- tests/end-to-end/hooks/data_source/test_database.py | 10 +++++----- tests/end-to-end/hooks/data_source/test_lvm.py | 2 +- tests/end-to-end/hooks/data_source/test_zfs.py | 2 +- tests/end-to-end/hooks/monitoring/test_monitoring.py | 2 +- tests/end-to-end/test_borgmatic.py | 2 +- tests/end-to-end/test_environment_variable.py | 2 +- tests/end-to-end/test_passcommand.py | 2 +- 19 files changed, 31 insertions(+), 28 deletions(-) diff --git a/borgmatic/actions/browse/directory_list.py b/borgmatic/actions/browse/directory_list.py index 1cfe36ec..ff331e27 100644 --- a/borgmatic/actions/browse/directory_list.py +++ b/borgmatic/actions/browse/directory_list.py @@ -65,7 +65,7 @@ def add_archive_paths( sequence of ArchivePath instances, add the paths to the directory list as options, sorting and deduplicating the resulting directory list's options. - After all of this reshuffling, make sure the orignal highlighted option remains highlighted. + After all of this reshuffling, make sure the original highlighted option remains highlighted. ''' highlighted_option = directory_list.highlighted_option original_options_count = len(directory_list.options) @@ -154,10 +154,10 @@ class Directory_list(textual.widgets.OptionList): def on_mount(self): ''' - When this widget gets mounted in the DOM, subcribe to path loaded events so that we can find - out about relevant archive paths as they load. And if this is a root directory list, start - loading paths from the archive. If this is a non-root directory list, add any already loaded - archive paths to this widget as options. + When this widget gets mounted in the DOM, subscribe to path loaded events so that we can + find out about relevant archive paths as they load. And if this is a root directory list, + start loading paths from the archive. If this is a non-root directory list, add any already + loaded archive paths to this widget as options. Loading is started *after* subscribing to path loaded signals so that there's not a gap where we might miss out on any paths. diff --git a/borgmatic/actions/browse/logs.py b/borgmatic/actions/browse/logs.py index 40f4ae6d..c01d55c0 100644 --- a/borgmatic/actions/browse/logs.py +++ b/borgmatic/actions/browse/logs.py @@ -25,7 +25,7 @@ class Rich_color_formatter(logging.Formatter): def format(self, record): ''' - Given a log record, format it with Rich-compatibe color markup correponding to its log + Given a log record, format it with Rich-compatibe color markup corresponding to its log level. ''' borgmatic.logger.add_custom_log_levels() diff --git a/borgmatic/actions/browse/repositories_list.py b/borgmatic/actions/browse/repositories_list.py index 57ddc803..1caebc13 100644 --- a/borgmatic/actions/browse/repositories_list.py +++ b/borgmatic/actions/browse/repositories_list.py @@ -6,8 +6,8 @@ import borgmatic.actions.browse.bindings class Repositories_list(textual.widgets.OptionList): ''' A widget for selecting a single Borg repository from among the repositories in a borgmatic - configuratin file. The item selection event is handled in a Carousel instance, the parent widget - of a Repositories_list. + configuration file. The item selection event is handled in a Carousel instance, the parent + widget of a Repositories_list. ''' BINDINGS = borgmatic.actions.browse.bindings.OPTION_LIST_BINDINGS diff --git a/borgmatic/borg/borg.py b/borgmatic/borg/borg.py index dd46f687..20af8e11 100644 --- a/borgmatic/borg/borg.py +++ b/borgmatic/borg/borg.py @@ -31,7 +31,7 @@ def run_arbitrary_borg( borgmatic.logger.add_custom_log_levels() lock_wait = config.get('lock_wait', None) - try: # noqa: PLW0717 + try: options = options[1:] if options[0] == '--' else options # Borg commands like "key" have a sub-command ("export", etc.) that must follow it. diff --git a/borgmatic/commands/borgmatic.py b/borgmatic/commands/borgmatic.py index 1d4837c9..f2a3b613 100644 --- a/borgmatic/commands/borgmatic.py +++ b/borgmatic/commands/borgmatic.py @@ -212,7 +212,7 @@ def run_configuration(config_filename, config, config_paths, arguments): # noqa f"Skipping {'/'.join(skip_actions)} action{'s' if len(skip_actions) > 1 else ''} due to configured skip_actions", ) - try: # noqa: PLR1702, PLW0717 + try: # noqa: PLR1702 with ( Monitoring_hooks(config_filename, config, arguments, global_arguments), borgmatic.hooks.command.Before_after_hooks( @@ -823,7 +823,7 @@ def collect_highlander_action_summary_logs(configs, arguments, configuration_par ''' add_custom_log_levels() - try: # noqa: PLW0717 + try: if 'bootstrap' in arguments: try: local_borg_version = borg_version.local_borg_version( diff --git a/borgmatic/logger.py b/borgmatic/logger.py index 28e5f423..09414615 100644 --- a/borgmatic/logger.py +++ b/borgmatic/logger.py @@ -109,7 +109,7 @@ class JournaldHandler(logging.Handler): def emit(self, record): sock = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) - try: # noqa: PLW0717 + try: message_parts = [] entry = dict( MESSAGE=record.getMessage(), diff --git a/pyproject.toml b/pyproject.toml index 62e6a48d..f0748c4d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -134,5 +134,8 @@ known-first-party = ["borgmatic"] "T201", # print statement ] +[tool.ruff.lint.pylint] +max-statements-in-try = 35 + [tool.codespell] skip = ".git,.tox,build" diff --git a/tests/end-to-end/hooks/credential/test_container.py b/tests/end-to-end/hooks/credential/test_container.py index ea12fb21..6279f522 100644 --- a/tests/end-to-end/hooks/credential/test_container.py +++ b/tests/end-to-end/hooks/credential/test_container.py @@ -40,7 +40,7 @@ def test_container_secret(): original_working_directory = os.getcwd() os.chdir(temporary_directory) - try: # noqa: PLW0717 + try: config_path = os.path.join(temporary_directory, 'test.yaml') generate_configuration(config_path, repository_path, secrets_directory=temporary_directory) diff --git a/tests/end-to-end/hooks/credential/test_file.py b/tests/end-to-end/hooks/credential/test_file.py index 6aa80f98..0ae9b37a 100644 --- a/tests/end-to-end/hooks/credential/test_file.py +++ b/tests/end-to-end/hooks/credential/test_file.py @@ -40,7 +40,7 @@ def test_file_credential(): original_working_directory = os.getcwd() os.chdir(temporary_directory) - try: # noqa: PLW0717 + try: config_path = os.path.join(temporary_directory, 'test.yaml') credential_path = os.path.join(temporary_directory, 'mycredential') generate_configuration(config_path, repository_path, credential_path) diff --git a/tests/end-to-end/hooks/credential/test_keepassxc.py b/tests/end-to-end/hooks/credential/test_keepassxc.py index af02da7a..e990458f 100644 --- a/tests/end-to-end/hooks/credential/test_keepassxc.py +++ b/tests/end-to-end/hooks/credential/test_keepassxc.py @@ -39,7 +39,7 @@ def test_keepassxc_password(): original_working_directory = os.getcwd() os.chdir(temporary_directory) - try: # noqa: PLW0717 + try: config_path = os.path.join(temporary_directory, 'test.yaml') generate_configuration(config_path, repository_path) diff --git a/tests/end-to-end/hooks/credential/test_systemd.py b/tests/end-to-end/hooks/credential/test_systemd.py index 9710cdd0..375eb476 100644 --- a/tests/end-to-end/hooks/credential/test_systemd.py +++ b/tests/end-to-end/hooks/credential/test_systemd.py @@ -38,7 +38,7 @@ def test_systemd_credential(): original_working_directory = os.getcwd() os.chdir(temporary_directory) - try: # noqa: PLW0717 + try: config_path = os.path.join(temporary_directory, 'test.yaml') generate_configuration(config_path, repository_path) diff --git a/tests/end-to-end/hooks/data_source/test_btrfs.py b/tests/end-to-end/hooks/data_source/test_btrfs.py index 38773cde..15d8ec97 100644 --- a/tests/end-to-end/hooks/data_source/test_btrfs.py +++ b/tests/end-to-end/hooks/data_source/test_btrfs.py @@ -35,7 +35,7 @@ def test_btrfs_create_and_list(): temporary_directory = tempfile.mkdtemp() repository_path = os.path.join(temporary_directory, 'test.borg') - try: # noqa: PLW0717 + try: config_path = os.path.join(temporary_directory, 'test.yaml') generate_configuration(config_path, repository_path) diff --git a/tests/end-to-end/hooks/data_source/test_database.py b/tests/end-to-end/hooks/data_source/test_database.py index 32214198..aed8e0a7 100644 --- a/tests/end-to-end/hooks/data_source/test_database.py +++ b/tests/end-to-end/hooks/data_source/test_database.py @@ -443,7 +443,7 @@ def test_database_dump_and_restore(): original_working_directory = os.getcwd() - try: # noqa: PLW0717 + try: config_path = os.path.join(temporary_directory, 'test.yaml') config = write_configuration( temporary_directory, @@ -501,7 +501,7 @@ def test_database_dump_and_restore_with_restore_cli_flags(): original_working_directory = os.getcwd() - try: # noqa: PLW0717 + try: config_path = os.path.join(temporary_directory, 'test.yaml') config = write_simple_custom_restore_configuration( temporary_directory, @@ -582,7 +582,7 @@ def test_database_dump_and_restore_with_restore_configuration_options(): original_working_directory = os.getcwd() - try: # noqa: PLW0717 + try: config_path = os.path.join(temporary_directory, 'test.yaml') config = write_custom_restore_configuration( temporary_directory, @@ -641,7 +641,7 @@ def test_database_dump_and_restore_with_directory_format(): original_working_directory = os.getcwd() - try: # noqa: PLW0717 + try: config_path = os.path.join(temporary_directory, 'test.yaml') config = write_configuration( temporary_directory, @@ -737,7 +737,7 @@ def test_database_dump_and_restore_containers(): os.environ['PATH'] = f'/app/tests/end-to-end/commands:{original_path}' - try: # noqa: PLW0717 + try: config_path = os.path.join(temporary_directory, 'test.yaml') config = write_container_configuration( temporary_directory, diff --git a/tests/end-to-end/hooks/data_source/test_lvm.py b/tests/end-to-end/hooks/data_source/test_lvm.py index dd9895c9..5d30f869 100644 --- a/tests/end-to-end/hooks/data_source/test_lvm.py +++ b/tests/end-to-end/hooks/data_source/test_lvm.py @@ -41,7 +41,7 @@ def test_lvm_create_and_list(): temporary_directory = tempfile.mkdtemp() repository_path = os.path.join(temporary_directory, 'test.borg') - try: # noqa: PLW0717 + try: config_path = os.path.join(temporary_directory, 'test.yaml') generate_configuration(config_path, repository_path) diff --git a/tests/end-to-end/hooks/data_source/test_zfs.py b/tests/end-to-end/hooks/data_source/test_zfs.py index 186f5575..8f750e62 100644 --- a/tests/end-to-end/hooks/data_source/test_zfs.py +++ b/tests/end-to-end/hooks/data_source/test_zfs.py @@ -37,7 +37,7 @@ def test_zfs_create_and_list(): temporary_directory = tempfile.mkdtemp() repository_path = os.path.join(temporary_directory, 'test.borg') - try: # noqa: PLW0717 + try: config_path = os.path.join(temporary_directory, 'test.yaml') generate_configuration(config_path, repository_path) diff --git a/tests/end-to-end/hooks/monitoring/test_monitoring.py b/tests/end-to-end/hooks/monitoring/test_monitoring.py index 7b40d836..ec5b7b5c 100644 --- a/tests/end-to-end/hooks/monitoring/test_monitoring.py +++ b/tests/end-to-end/hooks/monitoring/test_monitoring.py @@ -129,7 +129,7 @@ def test_borgmatic_command(monitoring_hook_configuration, expected_request_count os.mkdir(extract_path) os.chdir(extract_path) - try: # noqa: PLW0717 + try: config_path = os.path.join(temporary_directory, 'test.yaml') generate_configuration(config_path, repository_path, monitoring_hook_configuration) diff --git a/tests/end-to-end/test_borgmatic.py b/tests/end-to-end/test_borgmatic.py index 51d87ae6..766c39a9 100644 --- a/tests/end-to-end/test_borgmatic.py +++ b/tests/end-to-end/test_borgmatic.py @@ -76,7 +76,7 @@ def test_borgmatic_command(generate_configuration): os.mkdir(extract_path) os.chdir(extract_path) - try: # noqa: PLW0717 + try: config_path = os.path.join(temporary_directory, 'test.yaml') generate_configuration(config_path, repository_path) diff --git a/tests/end-to-end/test_environment_variable.py b/tests/end-to-end/test_environment_variable.py index f91356d2..83d87e8e 100644 --- a/tests/end-to-end/test_environment_variable.py +++ b/tests/end-to-end/test_environment_variable.py @@ -44,7 +44,7 @@ def test_borgmatic_command(): os.chdir(extract_path) environment = dict(os.environ, PASSPHRASE='test') - try: # noqa: PLW0717 + try: config_path = os.path.join(temporary_directory, 'test.yaml') generate_configuration(config_path, repository_path) diff --git a/tests/end-to-end/test_passcommand.py b/tests/end-to-end/test_passcommand.py index aeb61176..d650d82d 100644 --- a/tests/end-to-end/test_passcommand.py +++ b/tests/end-to-end/test_passcommand.py @@ -40,7 +40,7 @@ def test_borgmatic_command(): os.mkdir(extract_path) os.chdir(extract_path) - try: # noqa: PLW0717 + try: config_path = os.path.join(temporary_directory, 'test.yaml') generate_configuration(config_path, repository_path)