Fix actor, director tests using freeze time by ignoring transformers package

transformers package was causing freeze time to fail during setup
This commit is contained in:
Debanjum Singh Solanky
2024-02-05 20:02:54 +05:30
parent c40f642afa
commit 0d949140f4
4 changed files with 15 additions and 13 deletions

View File

@@ -41,7 +41,7 @@ freezegun.configure(extend_ignore_list=["transformers"])
# ---------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------
@pytest.mark.xfail(reason="Search actor isn't very date aware nor capable of formatting") @pytest.mark.xfail(reason="Search actor isn't very date aware nor capable of formatting")
@pytest.mark.chatquality @pytest.mark.chatquality
@freeze_time("1984-04-02") @freeze_time("1984-04-02", ignore=["transformers"])
def test_extract_question_with_date_filter_from_relative_day(loaded_model): def test_extract_question_with_date_filter_from_relative_day(loaded_model):
# Act # Act
response = extract_questions_offline("Where did I go for dinner yesterday?", loaded_model=loaded_model) response = extract_questions_offline("Where did I go for dinner yesterday?", loaded_model=loaded_model)
@@ -61,7 +61,7 @@ def test_extract_question_with_date_filter_from_relative_day(loaded_model):
# ---------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------
@pytest.mark.xfail(reason="Search actor still isn't very date aware nor capable of formatting") @pytest.mark.xfail(reason="Search actor still isn't very date aware nor capable of formatting")
@pytest.mark.chatquality @pytest.mark.chatquality
@freeze_time("1984-04-02") @freeze_time("1984-04-02", ignore=["transformers"])
def test_extract_question_with_date_filter_from_relative_month(loaded_model): def test_extract_question_with_date_filter_from_relative_month(loaded_model):
# Act # Act
response = extract_questions_offline("Which countries did I visit last month?", loaded_model=loaded_model) response = extract_questions_offline("Which countries did I visit last month?", loaded_model=loaded_model)
@@ -83,7 +83,7 @@ def test_extract_question_with_date_filter_from_relative_month(loaded_model):
# ---------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------
@pytest.mark.xfail(reason="Chat actor still isn't very date aware nor capable of formatting") @pytest.mark.xfail(reason="Chat actor still isn't very date aware nor capable of formatting")
@pytest.mark.chatquality @pytest.mark.chatquality
@freeze_time("1984-04-02") @freeze_time("1984-04-02", ignore=["transformers"])
def test_extract_question_with_date_filter_from_relative_year(): def test_extract_question_with_date_filter_from_relative_year():
# Act # Act
response = extract_questions_offline("Which countries have I visited this year?") response = extract_questions_offline("Which countries have I visited this year?")
@@ -102,7 +102,7 @@ def test_extract_question_with_date_filter_from_relative_year():
# ---------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------
@pytest.mark.chatquality @pytest.mark.chatquality
@freeze_time("1984-04-02") @freeze_time("1984-04-02", ignore=["transformers"])
def test_extract_question_includes_root_question(loaded_model): def test_extract_question_includes_root_question(loaded_model):
# Act # Act
response = extract_questions_offline("Which countries have I visited this year?", loaded_model=loaded_model) response = extract_questions_offline("Which countries have I visited this year?", loaded_model=loaded_model)

View File

@@ -301,11 +301,14 @@ def test_answer_not_known_using_notes_command(client_offline_chat, default_user2
@pytest.mark.xfail(AssertionError, reason="Chat director not capable of answering time aware questions yet") @pytest.mark.xfail(AssertionError, reason="Chat director not capable of answering time aware questions yet")
@pytest.mark.chatquality @pytest.mark.chatquality
@pytest.mark.django_db(transaction=True) @pytest.mark.django_db(transaction=True)
@freeze_time("2023-04-01") @freeze_time("2023-04-01", ignore=["transformers"])
def test_answer_requires_current_date_awareness(client_offline_chat): def test_answer_requires_current_date_awareness(client_offline_chat):
"Chat actor should be able to answer questions relative to current date using provided notes" "Chat actor should be able to answer questions relative to current date using provided notes"
# Arrange
query = urllib.parse.quote("Where did I have lunch today?")
# Act # Act
response = client_offline_chat.get(f'/api/chat?q="Where did I have lunch today?"&stream=true') response = client_offline_chat.get(f"/api/chat?q={query}&stream=true")
response_message = response.content.decode("utf-8") response_message = response.content.decode("utf-8")
# Assert # Assert
@@ -320,7 +323,7 @@ def test_answer_requires_current_date_awareness(client_offline_chat):
@pytest.mark.xfail(AssertionError, reason="Chat director not capable of answering this question yet") @pytest.mark.xfail(AssertionError, reason="Chat director not capable of answering this question yet")
@pytest.mark.chatquality @pytest.mark.chatquality
@pytest.mark.django_db(transaction=True) @pytest.mark.django_db(transaction=True)
@freeze_time("2023-04-01") @freeze_time("2023-04-01", ignore=["transformers"])
def test_answer_requires_date_aware_aggregation_across_provided_notes(client_offline_chat): def test_answer_requires_date_aware_aggregation_across_provided_notes(client_offline_chat):
"Chat director should be able to answer questions that require date aware aggregation across multiple notes" "Chat director should be able to answer questions that require date aware aggregation across multiple notes"
# Act # Act

View File

@@ -22,7 +22,7 @@ freezegun.configure(extend_ignore_list=["transformers"])
# Test # Test
# ---------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------
@pytest.mark.chatquality @pytest.mark.chatquality
@freeze_time("1984-04-02") @freeze_time("1984-04-02", ignore=["transformers"])
def test_extract_question_with_date_filter_from_relative_day(): def test_extract_question_with_date_filter_from_relative_day():
# Act # Act
response = extract_questions("Where did I go for dinner yesterday?") response = extract_questions("Where did I go for dinner yesterday?")
@@ -41,7 +41,7 @@ def test_extract_question_with_date_filter_from_relative_day():
# ---------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------
@pytest.mark.chatquality @pytest.mark.chatquality
@freeze_time("1984-04-02") @freeze_time("1984-04-02", ignore=["transformers"])
def test_extract_question_with_date_filter_from_relative_month(): def test_extract_question_with_date_filter_from_relative_month():
# Act # Act
response = extract_questions("Which countries did I visit last month?") response = extract_questions("Which countries did I visit last month?")
@@ -56,7 +56,7 @@ def test_extract_question_with_date_filter_from_relative_month():
# ---------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------
@pytest.mark.chatquality @pytest.mark.chatquality
@freeze_time("1984-04-02") @freeze_time("1984-04-02", ignore=["transformers"])
def test_extract_question_with_date_filter_from_relative_year(): def test_extract_question_with_date_filter_from_relative_year():
# Act # Act
response = extract_questions("Which countries have I visited this year?") response = extract_questions("Which countries have I visited this year?")

View File

@@ -277,7 +277,7 @@ def test_answer_not_known_using_notes_command(chat_client_no_background, default
@pytest.mark.xfail(AssertionError, reason="Chat director not capable of answering time aware questions yet") @pytest.mark.xfail(AssertionError, reason="Chat director not capable of answering time aware questions yet")
@pytest.mark.django_db(transaction=True) @pytest.mark.django_db(transaction=True)
@pytest.mark.chatquality @pytest.mark.chatquality
@freeze_time("2023-04-01") @freeze_time("2023-04-01", ignore=["transformers"])
def test_answer_requires_current_date_awareness(chat_client): def test_answer_requires_current_date_awareness(chat_client):
"Chat actor should be able to answer questions relative to current date using provided notes" "Chat actor should be able to answer questions relative to current date using provided notes"
# Act # Act
@@ -295,11 +295,10 @@ def test_answer_requires_current_date_awareness(chat_client):
# ---------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------
@pytest.mark.django_db(transaction=True) @pytest.mark.django_db(transaction=True)
@pytest.mark.chatquality @pytest.mark.chatquality
@freeze_time("2023-04-01") @freeze_time("2023-04-01", ignore=["transformers"])
def test_answer_requires_date_aware_aggregation_across_provided_notes(chat_client): def test_answer_requires_date_aware_aggregation_across_provided_notes(chat_client):
"Chat director should be able to answer questions that require date aware aggregation across multiple notes" "Chat director should be able to answer questions that require date aware aggregation across multiple notes"
# Act # Act
response = chat_client.get(f'/api/chat?q="How much did I spend on dining this year?"&stream=true') response = chat_client.get(f'/api/chat?q="How much did I spend on dining this year?"&stream=true')
response_message = response.content.decode("utf-8") response_message = response.content.decode("utf-8")