From 87bfd6e97f3c2927762262f51604c2c77976ea35 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Mon, 30 Mar 2026 12:37:42 -0700 Subject: [PATCH] Fix end-to-end tests. --- borgmatic/config/arguments.py | 2 +- borgmatic/config/load.py | 2 +- pyproject.toml | 3 ++- test_requirements.txt | 1 + tests/end-to-end/docker-compose.yaml | 2 +- tests/end-to-end/hooks/monitoring/test_monitoring.py | 3 ++- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/borgmatic/config/arguments.py b/borgmatic/config/arguments.py index 71603bf6..295f48c5 100644 --- a/borgmatic/config/arguments.py +++ b/borgmatic/config/arguments.py @@ -116,7 +116,7 @@ def convert_value_type(value, option_type): raise ValueError(f'Argument value "{value}" is invalid: {error.problem}') if not isinstance(parsed_value, borgmatic.config.schema.parse_type(option_type)): - raise ValueError(f'Argument value "{value}" is not of the expected type: {option_type}') # noqa: TRY004 + raise ValueError(f'Argument value "{value}" is not of the expected type: {option_type}') return parsed_value diff --git a/borgmatic/config/load.py b/borgmatic/config/load.py index 86fa6bc3..d16d7ad9 100644 --- a/borgmatic/config/load.py +++ b/borgmatic/config/load.py @@ -84,7 +84,7 @@ def raise_retain_node_error(loader, node): Also raise ValueError if a scalar node is given, as "!retain" is not supported on scalar nodes. ''' if isinstance(node, (ruamel.yaml.nodes.MappingNode, ruamel.yaml.nodes.SequenceNode)): - raise ValueError( # noqa: TRY004 + raise ValueError( 'The !retain tag may only be used within a configuration file containing a merged !include tag.', ) diff --git a/pyproject.toml b/pyproject.toml index a909d1ac..8808633c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ namespaces = false [tool.pytest.ini_options] testpaths = "tests" -addopts = "--cov-report term-missing:skip-covered --cov=borgmatic --no-cov-on-fail --cov-fail-under=100 --ignore=tests/end-to-end" +addopts = "--cov-report term-missing:skip-covered --cov=borgmatic --no-cov-on-fail --cov-fail-under=100 --ignore=tests/end-to-end --timeout=60" [tool.ruff] line-length = 100 @@ -100,6 +100,7 @@ ignore = [ "S404", # subprocess import "SIM115", # open() without context manager "SIM905", # split() on literal string + "TRY004", # type check and raise something other than TypeError ] [tool.ruff.lint.flake8-quotes] diff --git a/test_requirements.txt b/test_requirements.txt index 303375ab..9cfb2238 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -17,6 +17,7 @@ pluggy==1.6.0 pygments==2.20.0 pytest==9.0.2 pytest-cov==7.1.0 +pytest-timeout==2.4.0 pyyaml>5.0.0 referencing==0.37.0 requests==2.33.1 diff --git a/tests/end-to-end/docker-compose.yaml b/tests/end-to-end/docker-compose.yaml index e62a00ae..e82c47de 100644 --- a/tests/end-to-end/docker-compose.yaml +++ b/tests/end-to-end/docker-compose.yaml @@ -44,7 +44,7 @@ services: MONGO_INITDB_ROOT_PASSWORD: test2 command: docker-entrypoint.sh --port=27018 tests: - image: docker.io/alpine:3.22 + image: docker.io/alpine:3.23 environment: TEST_CONTAINER: true volumes: diff --git a/tests/end-to-end/hooks/monitoring/test_monitoring.py b/tests/end-to-end/hooks/monitoring/test_monitoring.py index e96128f8..ec5b7b5c 100644 --- a/tests/end-to-end/hooks/monitoring/test_monitoring.py +++ b/tests/end-to-end/hooks/monitoring/test_monitoring.py @@ -69,6 +69,7 @@ class Background_web_server: self.thread.join() +FINISH = 1 START_AND_FINISH = 2 START_LOG_AND_FINISH = 3 @@ -94,7 +95,7 @@ START_LOG_AND_FINISH = 3 ), ( 'loki:\n url: http://localhost:12345/loki/api/v1/push\n labels:\n app: borgmatic\n send_logs: true', - START_AND_FINISH, + FINISH, ), ( 'loki:\n url: http://localhost:12345/loki/api/v1/push\n labels:\n app: borgmatic',