Fix lint errors: remove unused variable and add raw string prefixes

- Remove unused 'crew' variable in test_hierarchical_crew_does_not_propagate_agent_tools_to_manager (F841)
- Add raw string prefixes to regex patterns to comply with RUF043 linting rule
- Pre-existing RUF043 errors in changed files were blocking PR, so fixed them

Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
Devin AI
2025-10-09 15:51:17 +00:00
parent 01114168df
commit 5ccdfdb1d3
2 changed files with 5 additions and 5 deletions

View File

@@ -200,7 +200,7 @@ def test_async_task_cannot_include_sequential_async_tasks_in_context(
# This should raise an error because task2 is async and has task1 in its context without a sync task in between # This should raise an error because task2 is async and has task1 in its context without a sync task in between
with pytest.raises( with pytest.raises(
ValueError, ValueError,
match="Task 'Task 2' is asynchronous and cannot include other sequential asynchronous tasks in its context.", match=r"Task 'Task 2' is asynchronous and cannot include other sequential asynchronous tasks in its context.",
): ):
Crew(tasks=[task1, task2, task3, task4, task5], agents=[researcher, writer]) Crew(tasks=[task1, task2, task3, task4, task5], agents=[researcher, writer])
@@ -238,7 +238,7 @@ def test_context_no_future_tasks(researcher, writer):
# This should raise an error because task1 has a context dependency on a future task (task4) # This should raise an error because task1 has a context dependency on a future task (task4)
with pytest.raises( with pytest.raises(
ValueError, ValueError,
match="Task 'Task 1' has a context dependency on a future task 'Task 4', which is not allowed.", match=r"Task 'Task 1' has a context dependency on a future task 'Task 4', which is not allowed.",
): ):
Crew(tasks=[task1, task2, task3, task4], agents=[researcher, writer]) Crew(tasks=[task1, task2, task3, task4], agents=[researcher, writer])
@@ -3339,7 +3339,7 @@ def test_replay_with_invalid_task_id():
): ):
with pytest.raises( with pytest.raises(
ValueError, ValueError,
match="Task with id bf5b09c9-69bd-4eb8-be12-f9e5bae31c2d not found in the crew's tasks.", match=r"Task with id bf5b09c9-69bd-4eb8-be12-f9e5bae31c2d not found in the crew's tasks.",
): ):
crew.replay("bf5b09c9-69bd-4eb8-be12-f9e5bae31c2d") crew.replay("bf5b09c9-69bd-4eb8-be12-f9e5bae31c2d")
@@ -3842,7 +3842,7 @@ def test_hierarchical_crew_does_not_propagate_agent_tools_to_manager():
agent=agent_with_tools, agent=agent_with_tools,
) )
crew = Crew( Crew(
agents=[agent_with_tools], agents=[agent_with_tools],
tasks=[task], tasks=[task],
process=Process.hierarchical, process=Process.hierarchical,

View File

@@ -1222,7 +1222,7 @@ def test_create_directory_false():
assert not resolved_dir.exists() assert not resolved_dir.exists()
with pytest.raises( with pytest.raises(
RuntimeError, match="Directory .* does not exist and create_directory is False" RuntimeError, match=r"Directory .* does not exist and create_directory is False"
): ):
task._save_file("test content") task._save_file("test content")