Skip to content

Commit 007c055

Browse files
committed
linting updates
1 parent 8b8578f commit 007c055

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

tests/test_helpers.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def test_generate_bulk_actions_delete():
5454
def test_generate_bulk_actions_invalid_action_raises_error():
5555
records = [{"timdex_record_id": "12345", "other_fields": "some_data"}]
5656
actions = helpers.generate_bulk_actions("test-index", records, "wrong")
57-
with pytest.raises(ValueError, match="Invalid action parameter"):
57+
with pytest.raises(ValueError, match=r"Invalid action parameter"):
5858
next(actions)
5959

6060

@@ -70,14 +70,15 @@ def test_validate_bulk_cli_options_neither_index_nor_source_passed(
7070
test_opensearch_client,
7171
):
7272
with pytest.raises(
73-
UsageError, match="Must provide either an existing index name or a valid source."
73+
UsageError, match=r"Must provide either an existing index name or a valid source."
7474
):
7575
helpers.validate_bulk_cli_options(None, None, test_opensearch_client)
7676

7777

7878
def test_validate_bulk_cli_options_index_and_source_passed(test_opensearch_client):
7979
with pytest.raises(
80-
UsageError, match="Only one of --index and --source options is allowed, not both."
80+
UsageError,
81+
match=r"Only one of --index and --source options is allowed, not both.",
8182
):
8283
helpers.validate_bulk_cli_options(
8384
"index-name", "source-name", test_opensearch_client
@@ -87,7 +88,7 @@ def test_validate_bulk_cli_options_index_and_source_passed(test_opensearch_clien
8788
@my_vcr.use_cassette("helpers/bulk_cli_nonexistent_index.yaml")
8889
def test_validate_bulk_cli_options_nonexistent_index_passed(test_opensearch_client):
8990
with pytest.raises(
90-
BadParameter, match="Index 'wrong' does not exist in the cluster."
91+
BadParameter, match=r"Index 'wrong' does not exist in the cluster."
9192
):
9293
helpers.validate_bulk_cli_options("wrong", None, test_opensearch_client)
9394

@@ -97,8 +98,8 @@ def test_validate_bulk_cli_options_no_primary_index_for_source(test_opensearch_c
9798
with pytest.raises(
9899
BadParameter,
99100
match=(
100-
"No index name was passed and there is no "
101-
"primary-aliased index for source 'dspace'."
101+
r"No index name was passed and there is no "
102+
r"primary-aliased index for source 'dspace'."
102103
),
103104
):
104105
helpers.validate_bulk_cli_options(None, "dspace", test_opensearch_client)

tim/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def ping(ctx: click.Context) -> None:
113113
@click.option(
114114
"-i",
115115
"--index",
116-
callback=helpers.validate_index_name,
116+
callback=helpers.validate_index_name, # type: ignore[arg-type]
117117
help="Optional name to use for new index, must use the convention "
118118
"'source-YYYY-MM-DDthh-mm-ss'.",
119119
)

0 commit comments

Comments
 (0)