From ce7c60137bb440d727b3d0ffafd34cf3f5d4938a Mon Sep 17 00:00:00 2001 From: peterstone2017 Date: Fri, 17 Jun 2022 10:16:45 -0500 Subject: [PATCH 1/2] lable flaky httpfunction tests in thirdparty pystein http tests --- tests/unittests/test_third_party_http_functions.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/unittests/test_third_party_http_functions.py b/tests/unittests/test_third_party_http_functions.py index 8e2aca4e3..9a254fc0d 100644 --- a/tests/unittests/test_third_party_http_functions.py +++ b/tests/unittests/test_third_party_http_functions.py @@ -9,6 +9,7 @@ from azure_functions_worker import testutils from azure_functions_worker.testutils import UNIT_TESTS_ROOT +from tests.unittests.load_functions import pytest HOST_JSON_TEMPLATE = """\ { @@ -76,6 +77,7 @@ def check_log_debug_with_user_logging(self, self.assertIn('logging debug', host_out) self.assertIn('logging error', host_out) + @pytest.mark.flaky(reruns=3) def test_print_logging_no_flush(self): r = self.webhost.request('GET', 'print_logging?message=Secret42', no_prefix=True) @@ -85,6 +87,7 @@ def test_print_logging_no_flush(self): def check_log_print_logging_no_flush(self, host_out: typing.List[str]): self.assertIn('Secret42', host_out) + @pytest.mark.flaky(reruns=3) def test_print_logging_with_flush(self): r = self.webhost.request('GET', 'print_logging?flush=true&message' @@ -97,6 +100,7 @@ def check_log_print_logging_with_flush(self, host_out: typing.List[str]): self.assertIn('Secret42', host_out) + @pytest.mark.flaky(reruns=3) def test_print_to_console_stdout(self): r = self.webhost.request('GET', 'print_logging?console=true&message' @@ -105,6 +109,7 @@ def test_print_to_console_stdout(self): self.assertEqual(r.status_code, 200) self.assertEqual(r.text, 'OK-print-logging') + @pytest.mark.flaky(reruns=3) def check_log_print_to_console_stdout(self, host_out: typing.List[str]): # System logs stdout should not exist in host_out @@ -192,6 +197,7 @@ def get_script_dir(cls): return UNIT_TESTS_ROOT / 'third_party_http_functions' / 'stein' / \ 'asgi_function' + @pytest.mark.flaky(reruns=3) def test_hijack_current_event_loop(self): r = self.webhost.request('GET', 'hijack_current_event_loop', no_prefix=True) From 735964ea19603951816cb0585db75cc00f214676 Mon Sep 17 00:00:00 2001 From: peterstone2017 Date: Fri, 17 Jun 2022 11:51:24 -0500 Subject: [PATCH 2/2] fix pytest import --- tests/unittests/test_third_party_http_functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unittests/test_third_party_http_functions.py b/tests/unittests/test_third_party_http_functions.py index 9a254fc0d..c432410f5 100644 --- a/tests/unittests/test_third_party_http_functions.py +++ b/tests/unittests/test_third_party_http_functions.py @@ -5,11 +5,11 @@ import pathlib import re import typing +import pytest from unittest.mock import patch from azure_functions_worker import testutils from azure_functions_worker.testutils import UNIT_TESTS_ROOT -from tests.unittests.load_functions import pytest HOST_JSON_TEMPLATE = """\ {