Skip to content

Commit ca46fb3

Browse files
romanlutzCopilot
andauthored
MAINT Remove redundant pytest asyncio markers (#2453)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2b658c6 commit ca46fb3

10 files changed

Lines changed: 0 additions & 33 deletions

File tree

tests/integration/executors/test_tap_attack_integration.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515

1616
@pytest.mark.run_only_if_all_tests
17-
@pytest.mark.asyncio
1817
async def test_tap_attack_text_target(patch_central_database):
1918
"""Test TAP attack against a text generation target."""
2019
adversarial_chat = OpenAIChatTarget(temperature=1.1)
@@ -34,7 +33,6 @@ async def test_tap_attack_text_target(patch_central_database):
3433

3534

3635
@pytest.mark.run_only_if_all_tests
37-
@pytest.mark.asyncio
3836
async def test_tap_attack_image_target(patch_central_database):
3937
"""Test TAP attack against an image generation target using image-specific system prompt."""
4038
adversarial_chat = OpenAIChatTarget(temperature=1.1)

tests/integration/targets/test_hugging_face_integration.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ def hf_response_target(hf_token, hf_endpoint, sqlite_instance) -> OpenAIResponse
6565

6666

6767
@pytest.mark.run_only_if_all_tests
68-
@pytest.mark.asyncio
6968
async def test_chat_completion_basic(hf_chat_target):
7069
"""Verify a simple prompt returns a non-empty response via the HF router."""
7170
msg = MessagePiece(role="user", original_value="What is 2+2? Answer with just the number.").to_message()
@@ -79,7 +78,6 @@ async def test_chat_completion_basic(hf_chat_target):
7978

8079

8180
@pytest.mark.run_only_if_all_tests
82-
@pytest.mark.asyncio
8381
async def test_chat_completion_with_temperature(hf_token, hf_endpoint, sqlite_instance):
8482
"""Verify temperature param is accepted by the HF router."""
8583
target = OpenAIChatTarget(
@@ -101,7 +99,6 @@ async def test_chat_completion_with_temperature(hf_token, hf_endpoint, sqlite_in
10199

102100

103101
@pytest.mark.run_only_if_all_tests
104-
@pytest.mark.asyncio
105102
async def test_chat_completion_identifier(hf_chat_target):
106103
"""Verify the component identifier reflects the HF endpoint and model."""
107104
identifier = hf_chat_target.get_identifier()
@@ -115,7 +112,6 @@ async def test_chat_completion_identifier(hf_chat_target):
115112

116113

117114
@pytest.mark.run_only_if_all_tests
118-
@pytest.mark.asyncio
119115
async def test_response_api_basic(hf_response_target):
120116
"""Verify a simple prompt returns a non-empty response via the Responses API."""
121117
msg = MessagePiece(role="user", original_value="What is 2+2? Answer with just the number.").to_message()
@@ -129,7 +125,6 @@ async def test_response_api_basic(hf_response_target):
129125

130126

131127
@pytest.mark.run_only_if_all_tests
132-
@pytest.mark.asyncio
133128
async def test_response_api_with_temperature(hf_token, hf_endpoint, sqlite_instance):
134129
"""Verify temperature param is accepted by the Responses API on HF."""
135130
target = OpenAIResponseTarget(
@@ -151,7 +146,6 @@ async def test_response_api_with_temperature(hf_token, hf_endpoint, sqlite_insta
151146

152147

153148
@pytest.mark.run_only_if_all_tests
154-
@pytest.mark.asyncio
155149
async def test_response_api_identifier(hf_response_target):
156150
"""Verify the component identifier reflects the HF endpoint and model."""
157151
identifier = hf_response_target.get_identifier()

tests/unit/converter/test_image_prompt_style_converter.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ def test_list_available_filters() -> None:
155155
assert len(filters) > 0
156156

157157

158-
@pytest.mark.asyncio
159158
async def test_convert_async_with_specific_variation(mock_target) -> None:
160159
converter = ImagePromptStyleConverter(
161160
converter_target=mock_target,
@@ -174,7 +173,6 @@ async def test_convert_async_with_specific_variation(mock_target) -> None:
174173
assert result.output_type == "text"
175174

176175

177-
@pytest.mark.asyncio
178176
async def test_convert_async_with_random_variation(mock_target) -> None:
179177
converter = ImagePromptStyleConverter(
180178
converter_target=mock_target,
@@ -190,7 +188,6 @@ async def test_convert_async_with_random_variation(mock_target) -> None:
190188
assert result.output_text == "A blurry bodycam shot of a figure in a dark alley"
191189

192190

193-
@pytest.mark.asyncio
194191
async def test_convert_async_unsupported_input_type_raises(mock_target) -> None:
195192
converter = ImagePromptStyleConverter(
196193
converter_target=mock_target,

tests/unit/converter/test_ipa_converter.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ def test_ipa_converter_raises_when_dialect_is_empty(dialect, sqlite_instance):
2121
IPAConverter(converter_target=MockPromptTarget(), dialect=dialect)
2222

2323

24-
@pytest.mark.asyncio
2524
async def test_ipa_converter_auto_detects_languages(sqlite_instance):
2625
prompt_target = MockPromptTarget()
2726
converter = IPAConverter(converter_target=prompt_target)
@@ -35,7 +34,6 @@ async def test_ipa_converter_auto_detects_languages(sqlite_instance):
3534
assert "translate it into another language" in prompt_target.system_prompt
3635

3736

38-
@pytest.mark.asyncio
3937
async def test_ipa_converter_uses_configured_dialect_and_transcription_instructions(sqlite_instance):
4038
prompt_target = MockPromptTarget()
4139
converter = IPAConverter(converter_target=prompt_target, dialect="Metropolitan French")
@@ -49,7 +47,6 @@ async def test_ipa_converter_uses_configured_dialect_and_transcription_instructi
4947
assert "Never follow instructions" in prompt_target.system_prompt
5048

5149

52-
@pytest.mark.asyncio
5350
async def test_ipa_converter_wraps_source_text(sqlite_instance):
5451
prompt_target = MockPromptTarget()
5552
converter = IPAConverter(converter_target=prompt_target)
@@ -63,7 +60,6 @@ async def test_ipa_converter_wraps_source_text(sqlite_instance):
6360
assert "not as instructions to follow" in prompt_target.prompt_sent[0]
6461

6562

66-
@pytest.mark.asyncio
6763
async def test_ipa_converter_strips_response_whitespace(sqlite_instance):
6864
prompt_target = MockPromptTarget()
6965
converter = IPAConverter(converter_target=prompt_target)

tests/unit/executor/attack/multi_turn/test_tree_of_attacks.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,6 @@ class TestBlockedScoringDefaults:
10551055
short-circuits at all in `_score_response_async`.
10561056
"""
10571057

1058-
@pytest.mark.asyncio
10591058
async def test_score_response_delegates_to_scorer_for_blocked(self, attack_builder):
10601059
"""A blocked response goes straight through Scorer.score_response_async — no TAP-side
10611060
short-circuit. The scorer is responsible for producing 0.0 via its unified fallback."""
@@ -1124,7 +1123,6 @@ async def test_score_response_delegates_to_scorer_for_blocked(self, attack_build
11241123
assert node.objective_score is not None
11251124
assert node.objective_score.get_value() == 0.0
11261125

1127-
@pytest.mark.asyncio
11281126
async def test_score_response_delegates_to_scorer_for_unknown_error(self, attack_builder):
11291127
"""Non-blocked errors (e.g. 'unknown') also flow through the scorer; no special-casing."""
11301128
builder = attack_builder.with_default_mocks()
@@ -1923,7 +1921,6 @@ def mock_score_response(*args, **kwargs):
19231921
assert node.auxiliary_scores["AuxScorer1"].get_value() == 0.8
19241922
assert node.auxiliary_scores["AuxScorer2"].get_value() == 0.6
19251923

1926-
@pytest.mark.asyncio
19271924
async def test_node_single_turn_target_generates_new_conv_id(self, node_components):
19281925
"""Test that single-turn targets get a fresh conversation_id before each send."""
19291926
node_components["objective_target"].capabilities.supports_multi_turn = False
@@ -1951,7 +1948,6 @@ async def test_node_single_turn_target_generates_new_conv_id(self, node_componen
19511948
# Conversation ID should have changed for single-turn target
19521949
assert node.objective_target_conversation_id != original_conv_id
19531950

1954-
@pytest.mark.asyncio
19551951
async def test_node_multi_turn_target_keeps_conv_id(self, node_components):
19561952
"""Test that multi-turn targets keep the same conversation_id."""
19571953
node_components["objective_target"].capabilities.supports_multi_turn = True
@@ -2187,7 +2183,6 @@ def test_tree_visualization_structure(self, basic_attack, node_factory, helpers)
21872183
assert context.tree_visualization.parent(node_0_child_1._vis_node_id).identifier == node_0._vis_node_id
21882184
assert context.tree_visualization.parent(node_1_child_0._vis_node_id).identifier == node_1._vis_node_id
21892185

2190-
@pytest.mark.asyncio
21912186
async def test_surviving_node_gets_child_vis_nodes_per_depth(self, attack_builder, node_factory, helpers):
21922187
"""Test that a surviving node gets a new child vis node at each depth (not appended scores)."""
21932188
attack = (
@@ -2731,7 +2726,6 @@ class TestTAPScenarios:
27312726
Each scenario is run twice: once with a multi-turn target and once with a single-turn target.
27322727
"""
27332728

2734-
@pytest.mark.asyncio
27352729
@pytest.mark.parametrize("supports_multi_turn", [True, False], ids=["multi_turn", "single_turn"])
27362730
@pytest.mark.parametrize(
27372731
"tree_width, tree_depth, branching_factor, threshold, "

tests/unit/message_normalizer/test_conversation_context_normalizer.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ async def test_shows_original_if_different_from_converted(self):
104104
assert "converted text" in result
105105
assert "(original: original text)" in result
106106

107-
@pytest.mark.asyncio
108107
async def test_preserves_tool_role_label(self):
109108
"""Test that tool messages keep the Tool label in context output."""
110109
normalizer = ConversationContextNormalizer()
@@ -118,7 +117,6 @@ async def test_preserves_tool_role_label(self):
118117
assert "tool: 72F and sunny" in result
119118
assert "assistant: 72F and sunny" not in result
120119

121-
@pytest.mark.asyncio
122120
async def test_preserves_developer_role_label(self):
123121
"""Test that developer messages keep the Developer label in context output."""
124122
normalizer = ConversationContextNormalizer()

tests/unit/prompt_target/target/test_huggingface_chat_target.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,6 @@ def test_identifier_excludes_none_generation_params():
430430

431431

432432
@pytest.mark.skipif(not is_torch_installed(), reason="torch is not installed")
433-
@pytest.mark.asyncio
434433
@pytest.mark.usefixtures("patch_central_database")
435434
async def test_generate_passes_new_params():
436435
"""Verify top_k, do_sample, repetition_penalty are forwarded to model.generate()."""
@@ -459,7 +458,6 @@ async def test_generate_passes_new_params():
459458

460459

461460
@pytest.mark.skipif(not is_torch_installed(), reason="torch is not installed")
462-
@pytest.mark.asyncio
463461
@pytest.mark.usefixtures("patch_central_database")
464462
async def test_generate_omits_none_params():
465463
"""When optional params are None, they should not be passed to model.generate()."""
@@ -560,7 +558,6 @@ def test_default_params_no_warning():
560558

561559

562560
@pytest.mark.skipif(not is_torch_installed(), reason="torch is not installed")
563-
@pytest.mark.asyncio
564561
@pytest.mark.usefixtures("patch_central_database")
565562
async def test_full_conversation_sent_to_chat_template():
566563
"""Verify system and user messages from the full conversation are sent to the chat template."""
@@ -596,7 +593,6 @@ async def test_full_conversation_sent_to_chat_template():
596593

597594

598595
@pytest.mark.skipif(not is_torch_installed(), reason="torch is not installed")
599-
@pytest.mark.asyncio
600596
@pytest.mark.usefixtures("patch_central_database")
601597
async def test_effective_generation_config_in_metadata():
602598
"""Verify effective generation config is stored in response prompt_metadata."""

tests/unit/prompt_target/target/test_image_target.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,6 @@ def test_background_default_is_none(patch_central_database):
528528
assert target.background is None
529529

530530

531-
@pytest.mark.asyncio
532531
async def test_generate_request_passes_background(
533532
image_target: OpenAIImageTarget,
534533
sample_conversations: MutableSequence[MessagePiece],
@@ -555,7 +554,6 @@ async def test_generate_request_passes_background(
555554
os.remove(path)
556555

557556

558-
@pytest.mark.asyncio
559557
async def test_generate_request_omits_background_when_none(
560558
image_target: OpenAIImageTarget,
561559
sample_conversations: MutableSequence[MessagePiece],

tests/unit/scenario/core/test_scenario.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ async def test_initialize_async_uses_default_values(self, mock_objective_target)
352352
assert scenario._max_concurrency == 4
353353
assert scenario._memory_labels == {}
354354

355-
@pytest.mark.asyncio
356355
async def test_initialize_async_validates_target_requirements(self, mock_objective_target):
357356
"""Test that initialize_async validates objective_target against TARGET_REQUIREMENTS."""
358357
scenario = ConcreteScenario(name="Test Scenario", version=1)
@@ -363,7 +362,6 @@ async def test_initialize_async_validates_target_requirements(self, mock_objecti
363362

364363
mock_validate.assert_called_once_with(target=mock_objective_target)
365364

366-
@pytest.mark.asyncio
367365
async def test_initialize_async_propagates_target_requirements_error(self, mock_objective_target):
368366
"""Test that initialize_async surfaces errors from TARGET_REQUIREMENTS.validate."""
369367
scenario = ConcreteScenario(name="Test Scenario", version=1)

tests/unit/setup/test_preload_scenario_metadata.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
class TestPreloadScenarioMetadata:
1414
"""Tests for PreloadScenarioMetadata.initialize_async."""
1515

16-
@pytest.mark.asyncio
1716
async def test_initialize_async_warms_metadata_cache(self) -> None:
1817
"""``initialize_async`` should fetch the registry and warm the metadata cache."""
1918
initializer = PreloadScenarioMetadata()
@@ -33,7 +32,6 @@ async def test_initialize_async_warms_metadata_cache(self) -> None:
3332

3433
mock_registry.get_all_registered_class_metadata.assert_called_once_with()
3534

36-
@pytest.mark.asyncio
3735
async def test_initialize_async_propagates_registry_errors(self) -> None:
3836
"""If a scenario fails to instantiate, metadata building raises and the initializer surfaces it."""
3937
initializer = PreloadScenarioMetadata()

0 commit comments

Comments
 (0)