Skip to content

Commit

Permalink
add skip flaky test decorator to FRC and FTC tests (Azure#27010)
Browse files Browse the repository at this point in the history
  • Loading branch information
catalinaperalta authored Oct 24, 2022
1 parent 4bcd521 commit 2c866d7
Show file tree
Hide file tree
Showing 33 changed files with 219 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from devtools_testutils import recorded_by_proxy, set_custom_default_matcher
from azure.ai.formrecognizer import FormRecognizerClient, FormContentType, FormRecognizerApiVersion
from testcase import FormRecognizerTest
from conftest import skip_flaky_test
from preparers import GlobalClientPreparer as _GlobalClientPreparer
from preparers import FormRecognizerPreparer

Expand All @@ -20,6 +21,7 @@
class TestBusinessCard(FormRecognizerTest):

@pytest.mark.live_test_only
@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy
Expand Down Expand Up @@ -65,6 +67,7 @@ def test_passing_bad_content_type_param_passed(self, **kwargs):
content_type="application/jpeg"
)

@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy
Expand Down Expand Up @@ -127,6 +130,7 @@ def test_business_card_multipage_pdf(self, client):
assert len(business_card.fields.get("CompanyNames").value) == 1
assert business_card.fields.get("CompanyNames").value[0].value == "Contoso"

@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from azure.ai.formrecognizer.aio import FormRecognizerClient
from azure.ai.formrecognizer import FormContentType, FormRecognizerApiVersion
from preparers import FormRecognizerPreparer
from conftest import skip_flaky_test
from asynctestcase import AsyncFormRecognizerTest
from preparers import GlobalClientPreparer as _GlobalClientPreparer

Expand All @@ -20,6 +21,7 @@
class TestBusinessCardAsync(AsyncFormRecognizerTest):

@pytest.mark.live_test_only
@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy_async
Expand Down Expand Up @@ -71,6 +73,7 @@ async def test_passing_bad_content_type_param_passed(self, **kwargs):
)

@pytest.mark.live_test_only
@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy_async
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from devtools_testutils import recorded_by_proxy
from azure.ai.formrecognizer import FormRecognizerClient, FormRecognizerApiVersion
from testcase import FormRecognizerTest
from conftest import skip_flaky_test
from preparers import GlobalClientPreparer as _GlobalClientPreparer
from preparers import FormRecognizerPreparer

Expand All @@ -18,6 +19,7 @@

class TestBusinessCardFromUrl(FormRecognizerTest):

@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from azure.ai.formrecognizer import FormRecognizerApiVersion
from azure.ai.formrecognizer.aio import FormRecognizerClient
from preparers import FormRecognizerPreparer
from conftest import skip_flaky_test
from asynctestcase import AsyncFormRecognizerTest
from preparers import GlobalClientPreparer as _GlobalClientPreparer

Expand All @@ -18,6 +19,7 @@

class TestBusinessCardFromUrlAsync(AsyncFormRecognizerTest):

@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy_async
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from testcase import FormRecognizerTest
from preparers import GlobalClientPreparer as _GlobalClientPreparer
from preparers import FormRecognizerPreparer
from conftest import skip_flaky_test

FormRecognizerClientPreparer = functools.partial(_GlobalClientPreparer, FormRecognizerClient)

Expand All @@ -37,6 +38,7 @@ def test_content_authentication_bad_key(self, formrecognizer_test_endpoint, form
with pytest.raises(ClientAuthenticationError):
poller = client.begin_recognize_content(b"xx", content_type="application/pdf")

@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy
Expand Down Expand Up @@ -84,6 +86,7 @@ def test_auto_detect_unsupported_stream_content(self, **kwargs):
my_file
)

@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy
Expand All @@ -109,6 +112,7 @@ def callback(raw_response, _, headers):
# Check form pages
self.assertFormPagesTransformCorrect(layout, read_results, page_results)

@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy
Expand All @@ -122,6 +126,7 @@ def test_content_reading_order(self, client):
result = poller.result()
assert result

@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy
Expand All @@ -147,6 +152,7 @@ def callback(raw_response, _, headers):
# Check form pages
self.assertFormPagesTransformCorrect(layout, read_results, page_results)

@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy
Expand All @@ -165,6 +171,7 @@ def test_content_stream_jpg(self, client):
assert layout.tables[0].page_number == 1
assert layout.tables[1].page_number== 1

@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy
Expand All @@ -177,6 +184,7 @@ def test_content_multipage(self, client):
assert len(result) == 3
self.assertFormPagesHasValues(result)

@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy
Expand All @@ -203,6 +211,7 @@ def callback(raw_response, _, headers):
self.assertFormPagesTransformCorrect(layout, read_results, page_results)

@pytest.mark.live_test_only
@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
def test_content_continuation_token(self, **kwargs):
Expand All @@ -218,6 +227,7 @@ def test_content_continuation_token(self, **kwargs):
initial_poller.wait() # necessary so azure-devtools doesn't throw assertion error

@pytest.mark.live_test_only
@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy
Expand All @@ -243,6 +253,7 @@ def callback(raw_response, _, headers):
# Check form pages
self.assertFormPagesTransformCorrect(layout, read_results, page_results)

@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy
Expand All @@ -257,6 +268,7 @@ def test_content_selection_marks(self, client):
assert layout.page_number == 1
self.assertFormPagesHasValues(result)

@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer(client_kwargs={"api_version": FormRecognizerApiVersion.V2_0})
@recorded_by_proxy
Expand All @@ -271,6 +283,7 @@ def test_content_selection_marks_v2(self, client):
assert layout.page_number == 1
self.assertFormPagesHasValues(result)

@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy
Expand All @@ -295,6 +308,7 @@ def test_content_specify_pages(self, client):
result = poller.result()
assert len(result) == 3

@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from preparers import FormRecognizerPreparer
from asynctestcase import AsyncFormRecognizerTest
from preparers import GlobalClientPreparer as _GlobalClientPreparer

from conftest import skip_flaky_test

FormRecognizerClientPreparer = functools.partial(_GlobalClientPreparer, FormRecognizerClient)

Expand Down Expand Up @@ -44,6 +44,7 @@ async def test_content_authentication_bad_key(self, formrecognizer_test_endpoint
result = await poller.result()

@pytest.mark.live_test_only
@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy_async
Expand Down Expand Up @@ -100,6 +101,7 @@ async def test_auto_detect_unsupported_stream_content(self, **kwargs):
result = await poller.result()

@pytest.mark.live_test_only
@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy_async
Expand Down Expand Up @@ -127,6 +129,7 @@ def callback(raw_response, _, headers):
self.assertFormPagesTransformCorrect(layout, read_results, page_results)

@pytest.mark.live_test_only
@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy_async
Expand Down Expand Up @@ -154,6 +157,7 @@ def callback(raw_response, _, headers):
self.assertFormPagesTransformCorrect(layout, read_results, page_results)

@pytest.mark.live_test_only
@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy_async
Expand All @@ -176,6 +180,7 @@ async def test_content_stream_jpg(self, client):
assert layout.tables[1].page_number== 1

@pytest.mark.live_test_only
@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy_async
Expand All @@ -190,6 +195,7 @@ async def test_content_multipage(self, client):
self.assertFormPagesHasValues(result)

@pytest.mark.live_test_only
@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy_async
Expand Down Expand Up @@ -217,6 +223,7 @@ def callback(raw_response, _, headers):
self.assertFormPagesTransformCorrect(layout, read_results, page_results)

@pytest.mark.live_test_only
@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
async def test_content_continuation_token(self, **kwargs):
Expand All @@ -233,6 +240,7 @@ async def test_content_continuation_token(self, **kwargs):


@pytest.mark.live_test_only
@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy_async
Expand Down Expand Up @@ -261,6 +269,7 @@ async def test_content_multipage_table_span_pdf(self, client):
self.assertFormPagesHasValues(result)

@pytest.mark.live_test_only
@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy_async
Expand All @@ -278,6 +287,7 @@ async def test_content_selection_marks(self, client):

@pytest.mark.skip()
@pytest.mark.live_test_only
@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer(client_kwargs={"api_version": FormRecognizerApiVersion.V2_0})
@recorded_by_proxy_async
Expand All @@ -294,6 +304,7 @@ async def test_content_selection_marks_v2(self, client):
self.assertFormPagesHasValues(result)

@pytest.mark.live_test_only
@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy_async
Expand All @@ -319,6 +330,7 @@ async def test_content_specify_pages(self, client):
assert len(result) == 3

@pytest.mark.live_test_only
@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy_async
Expand All @@ -334,6 +346,7 @@ async def test_content_reading_order(self, client):
assert result

@pytest.mark.live_test_only
@skip_flaky_test
@FormRecognizerPreparer()
@FormRecognizerClientPreparer()
@recorded_by_proxy_async
Expand Down
Loading

0 comments on commit 2c866d7

Please sign in to comment.