Skip to content

Commit ca5fb1e

Browse files
committed
ruff error fix
1 parent 19ae7fd commit ca5fb1e

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

tests/integration/test_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test_load_proper_config():
2525
def test_load_non_existent_config():
2626
"""Test how loading of non-existent config is handled."""
2727
with pytest.raises(
28-
FileNotFoundError, match="tests/config/non_existent_config.yaml"
28+
FileNotFoundError, match=r"tests/config/non_existent_config.yaml"
2929
):
3030
config.reload_from_yaml_file("tests/config/non_existent_config.yaml")
3131

tests/unit/app/endpoints/test_ols.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ def test_validate_question_too_long_query(llm_validate_question_mock):
371371
query = "Tell me about Kubernetes?"
372372
llm_request = LLMRequest(query=query, conversation_id=conversation_id)
373373
# PromptTooLongError should be caught and HTTPException needs to be raised
374-
with pytest.raises(HTTPException, match="413: {'response': 'Prompt is too long'"):
374+
with pytest.raises(HTTPException, match=r"413: {'response': 'Prompt is too long'"):
375375
ols.validate_question(conversation_id, llm_request)
376376

377377

tests/unit/app/models/test_config.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,7 +1703,7 @@ def test_tls_config_no_data_provided():
17031703
tls_config = TLSConfig(None)
17041704
with pytest.raises(
17051705
InvalidConfigurationError,
1706-
match="Can not enable TLS without ols_config.tls_config.tls_certificate_path",
1706+
match=r"Can not enable TLS without ols_config.tls_config.tls_certificate_path",
17071707
):
17081708
tls_config.validate_yaml(False)
17091709

@@ -1718,7 +1718,7 @@ def test_tls_config_no_tls_key_path():
17181718
)
17191719
with pytest.raises(
17201720
InvalidConfigurationError,
1721-
match="Can not enable TLS without ols_config.tls_config.tls_key_path",
1721+
match=r"Can not enable TLS without ols_config.tls_config.tls_key_path",
17221722
):
17231723
tls_config.validate_yaml(False)
17241724

@@ -3615,7 +3615,7 @@ def test_ols_config_with_non_existing_system_prompt(tmpdir):
36153615
"""Test the OLSConfig model with system prompt path specification that does not exist."""
36163616
with pytest.raises(
36173617
FileNotFoundError,
3618-
match="No such file or directory: 'tests/config/non_existing_file.txt'",
3618+
match=r"No such file or directory: 'tests/config/non_existing_file.txt'",
36193619
):
36203620
OLSConfig(
36213621
{
@@ -3921,7 +3921,7 @@ def test_missing_lightspeed_id_attribute():
39213921
}
39223922
]
39233923

3924-
with pytest.raises(KeyError, match="lightspeed id is missing."):
3924+
with pytest.raises(KeyError, match=r"lightspeed id is missing."):
39253925
config._parse_rhdh_lightspeed_config(data)
39263926

39273927

@@ -3936,7 +3936,7 @@ def test_missing_lightspeed_url_attribute():
39363936
"token": "lightspeed-token",
39373937
}
39383938
]
3939-
with pytest.raises(KeyError, match="lightspeed url is missing."):
3939+
with pytest.raises(KeyError, match=r"lightspeed url is missing."):
39403940
config._parse_rhdh_lightspeed_config(data)
39413941

39423942

@@ -3951,7 +3951,7 @@ def test_missing_lightspeed_models_attribute():
39513951
"token": "lightspeed-token",
39523952
}
39533953
]
3954-
with pytest.raises(KeyError, match="lightspeed models missing."):
3954+
with pytest.raises(KeyError, match=r"lightspeed models missing."):
39553955
config._parse_rhdh_lightspeed_config(data)
39563956

39573957

@@ -3966,7 +3966,7 @@ def test_missing_lightspeed_token_attribute():
39663966
"type": "lightspeed-type",
39673967
}
39683968
]
3969-
with pytest.raises(KeyError, match="lightspeed token is missing."):
3969+
with pytest.raises(KeyError, match=r"lightspeed token is missing."):
39703970
config._parse_rhdh_lightspeed_config(data)
39713971

39723972

tests/unit/app/models/test_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ def test_llm_request_provider_and_model():
6767
# model set and provider not
6868
with pytest.raises(
6969
ValidationError,
70-
match="LLM provider must be specified when the model is specified.",
70+
match=r"LLM provider must be specified when the model is specified.",
7171
):
7272
LLMRequest(query="bla", provider=None, model="davinci")
7373

7474
# provider set and model not
7575
with pytest.raises(
7676
ValidationError,
77-
match="LLM model must be specified when the provider is specified.",
77+
match=r"LLM model must be specified when the provider is specified.",
7878
):
7979
LLMRequest(query="bla", provider="openai", model=None)
8080

tests/unit/quota/test_quota_limiter_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,5 @@ def test_quota_limiters_unknown_limiter(postgres_mock):
123123
}
124124
]
125125
)
126-
with pytest.raises(ValueError, match="Invalid limiter type: UNKNOWN."):
126+
with pytest.raises(ValueError, match=r"Invalid limiter type: UNKNOWN."):
127127
QuotaLimiterFactory.quota_limiters(config)

tests/unit/utils/test_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1471,7 +1471,7 @@ def test_loading_incorrect_additional_config_file_rhdh_type():
14711471
def test_additional_config_file_incorrect_type():
14721472
"""Check how an additional configuration file is handled with an incorrect type."""
14731473
with pytest.raises(
1474-
ValueError, match="Configuration file type 'wrongtype' not recognized."
1474+
ValueError, match=r"Configuration file type 'wrongtype' not recognized."
14751475
):
14761476
config.reload_additional_config_file(
14771477
"tests/config/valid_rhdh_config.yaml", "wrongtype"

0 commit comments

Comments
 (0)