Skip to content

Commit

Permalink
Change preview tests to run all tests except integration ones (#6325)
Browse files Browse the repository at this point in the history
  • Loading branch information
silvanocerza authored Nov 17, 2023
1 parent dfc1d45 commit c26a932
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/tests_preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
run: pip install .[dev,preview,audio] langdetect transformers[torch,sentencepiece]==4.35.2 'sentence-transformers>=2.2.0' pypdf markdown-it-py mdit_plain tika 'azure-ai-formrecognizer>=3.2.0b2'

- name: Run
run: pytest -m "unit" test/preview
run: pytest -m "not integration" test/preview

- name: Calculate alert data
id: calculator
Expand Down Expand Up @@ -152,7 +152,6 @@ jobs:
- "branch:${{ github.ref_name }}"
- "url:https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
integration-tests-linux:
name: Integration / ubuntu-latest
needs: unit-tests
Expand Down Expand Up @@ -211,13 +210,12 @@ jobs:
- "branch:${{ github.ref_name }}"
- "url:https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
integration-tests-macos:
name: Integration / macos-latest
needs: unit-tests
runs-on: macos-latest-xl
env:
HAYSTACK_MPS_ENABLED : false
HAYSTACK_MPS_ENABLED: false
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -271,7 +269,6 @@ jobs:
- "branch:${{ github.ref_name }}"
- "url:https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
integration-tests-windows:
name: Integration / windows-latest
needs: unit-tests
Expand Down
18 changes: 9 additions & 9 deletions test/preview/components/builders/test_answer_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_run_without_pattern(self):
answers = output["answers"]
assert len(answers) == 1
assert answers[0].data == "Answer: AnswerString"
assert answers[0].meta == {}
assert answers[0].metadata == {}
assert answers[0].query == "test query"
assert answers[0].documents == []
assert isinstance(answers[0], GeneratedAnswer)
Expand All @@ -52,7 +52,7 @@ def test_run_with_pattern_with_capturing_group(self):
answers = output["answers"]
assert len(answers) == 1
assert answers[0].data == "AnswerString"
assert answers[0].meta == {}
assert answers[0].metadata == {}
assert answers[0].query == "test query"
assert answers[0].documents == []
assert isinstance(answers[0], GeneratedAnswer)
Expand All @@ -63,7 +63,7 @@ def test_run_with_pattern_without_capturing_group(self):
answers = output["answers"]
assert len(answers) == 1
assert answers[0].data == "'AnswerString'"
assert answers[0].meta == {}
assert answers[0].metadata == {}
assert answers[0].query == "test query"
assert answers[0].documents == []
assert isinstance(answers[0], GeneratedAnswer)
Expand All @@ -80,7 +80,7 @@ def test_run_with_pattern_set_at_runtime(self):
answers = output["answers"]
assert len(answers) == 1
assert answers[0].data == "AnswerString"
assert answers[0].meta == {}
assert answers[0].metadata == {}
assert answers[0].query == "test query"
assert answers[0].documents == []
assert isinstance(answers[0], GeneratedAnswer)
Expand All @@ -99,8 +99,8 @@ def test_run_with_documents_without_reference_pattern(self):
assert answers[0].metadata == {}
assert answers[0].query == "test query"
assert len(answers[0].documents) == 2
assert answers[0].documents[0].text == "test doc 1"
assert answers[0].documents[1].text == "test doc 2"
assert answers[0].documents[0].content == "test doc 1"
assert answers[0].documents[1].content == "test doc 2"

def test_run_with_documents_with_reference_pattern(self):
component = AnswerBuilder(reference_pattern="\\[(\\d+)\\]")
Expand All @@ -116,7 +116,7 @@ def test_run_with_documents_with_reference_pattern(self):
assert answers[0].metadata == {}
assert answers[0].query == "test query"
assert len(answers[0].documents) == 1
assert answers[0].documents[0].text == "test doc 2"
assert answers[0].documents[0].content == "test doc 2"

def test_run_with_documents_with_reference_pattern_and_no_match(self, caplog):
component = AnswerBuilder(reference_pattern="\\[(\\d+)\\]")
Expand Down Expand Up @@ -150,5 +150,5 @@ def test_run_with_reference_pattern_set_at_runtime(self):
assert answers[0].metadata == {}
assert answers[0].query == "test query"
assert len(answers[0].documents) == 2
assert answers[0].documents[0].text == "test doc 2"
assert answers[0].documents[1].text == "test doc 3"
assert answers[0].documents[0].content == "test doc 2"
assert answers[0].documents[1].content == "test doc 3"

0 comments on commit c26a932

Please sign in to comment.