Skip to content

Commit

Permalink
fix test_metrics_hierarchies teardown error
Browse files Browse the repository at this point in the history
  • Loading branch information
mastastny committed Nov 22, 2024
1 parent a94d2ce commit 64b13ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ types-braintree = "*"
types-stripe = "*"
types-Pillow = "*"
black = "*"
types-retry = "*"
# Have commented out python-language-server to make it available quickly
# for the development
#python-language-server = "*"
Expand Down Expand Up @@ -58,6 +59,7 @@ pytest-persistence = "*"
pytest-metadata = ">=3.0.0"
pytest-html = "*"
ansi2html = "*"
retry = "==0.9.2"

[requires]
python_version = "3"
7 changes: 5 additions & 2 deletions testsuite/tests/ui/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
import pytest
import pytest_html
from auth0.management import auth0
from retry.api import retry
from selenium.common import InvalidSessionIdException, WebDriverException
from threescale_api.errors import ApiClientError
from threescale_api.resources import Account, ApplicationPlan, Service
from PIL import Image

Expand Down Expand Up @@ -252,7 +254,7 @@ def _custom_ui_backend(name: str, system_name: str, description: str = "", endpo
backend.create(name, system_name, description, endpoint)
backend = resilient.resource_read_by_name(threescale.backends, system_name)
if autoclean and not testconfig["skip_cleanup"]:
request.addfinalizer(backend.delete)
request.addfinalizer(retry(exceptions=ApiClientError, tries=3, delay=1, backoff=2)(backend.delete))
return backend

return _custom_ui_backend
Expand All @@ -265,8 +267,9 @@ def ui_backend(custom_ui_backend, request):
return custom_ui_backend(name, name)


# custom_ui_backend dependency forces delete product first (backend cannot be deleted when is used by some product)
@pytest.fixture(scope="module")
def custom_ui_product(custom_admin_login, navigator, threescale, testconfig, request):
def custom_ui_product(custom_admin_login, navigator, threescale, testconfig, request, custom_ui_backend):
"""Parametrized custom Product created via UI"""

def _custom_ui_product(name: str, system_name: str, description: str = "", autoclean=True):
Expand Down

0 comments on commit 64b13ce

Please sign in to comment.