|
@@ -13,17 +13,17 @@ import pytest
|
|
|
|
|
|
from taipy.config import Config
|
|
from taipy.config import Config
|
|
from taipy.core.common._utils import _retry_read_entity
|
|
from taipy.core.common._utils import _retry_read_entity
|
|
-from taipy.core.exceptions import ModelNotFound
|
|
|
|
|
|
+from taipy.core.exceptions import InvalidExposedType
|
|
|
|
|
|
|
|
|
|
def test_retry_decorator(mocker):
|
|
def test_retry_decorator(mocker):
|
|
- func = mocker.Mock(side_effect=ModelNotFound())
|
|
|
|
|
|
+ func = mocker.Mock(side_effect=InvalidExposedType())
|
|
|
|
|
|
- @_retry_read_entity((ModelNotFound,))
|
|
|
|
|
|
+ @_retry_read_entity((InvalidExposedType,))
|
|
def decorated_func():
|
|
def decorated_func():
|
|
func()
|
|
func()
|
|
|
|
|
|
- with pytest.raises(ModelNotFound):
|
|
|
|
|
|
+ with pytest.raises(InvalidExposedType):
|
|
decorated_func()
|
|
decorated_func()
|
|
# Called once in the normal flow and no retry
|
|
# Called once in the normal flow and no retry
|
|
# The Config.core.read_entity_retry is set to 0 at conftest.py
|
|
# The Config.core.read_entity_retry is set to 0 at conftest.py
|
|
@@ -33,7 +33,7 @@ def test_retry_decorator(mocker):
|
|
func.reset_mock()
|
|
func.reset_mock()
|
|
|
|
|
|
Config.core.read_entity_retry = 3
|
|
Config.core.read_entity_retry = 3
|
|
- with pytest.raises(ModelNotFound):
|
|
|
|
|
|
+ with pytest.raises(InvalidExposedType):
|
|
decorated_func()
|
|
decorated_func()
|
|
# Called once in the normal flow and 3 more times on the retry flow
|
|
# Called once in the normal flow and 3 more times on the retry flow
|
|
assert func.call_count == 4
|
|
assert func.call_count == 4
|
|
@@ -43,7 +43,7 @@ def test_retry_decorator_exception_not_in_list(mocker):
|
|
func = mocker.Mock(side_effect=KeyError())
|
|
func = mocker.Mock(side_effect=KeyError())
|
|
Config.core.read_entity_retry = 3
|
|
Config.core.read_entity_retry = 3
|
|
|
|
|
|
- @_retry_read_entity((ModelNotFound,))
|
|
|
|
|
|
+ @_retry_read_entity((InvalidExposedType,))
|
|
def decorated_func():
|
|
def decorated_func():
|
|
func()
|
|
func()
|
|
|
|
|