From 67410a1abe0f3bce8dc150b0c8e27c693c3da867 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Mon, 2 Dec 2024 13:45:16 +0100 Subject: [PATCH] run create package automatically and wait for 60 for server to restart --- tests/test_server.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/test_server.py b/tests/test_server.py index d791348d8..9e278d016 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -7,9 +7,12 @@ from datetime import datetime, timedelta, timezone import os -import pytest +import sys +import subprocess import time +import pytest + from ayon_api import ( close_connection, create_folder, @@ -829,19 +832,25 @@ def test_addon_methods(): addon_name != addon["name"] for addon in get_addons_info()["addons"] ) + subprocess.run([sys.executable, "tests/resources/addon/create_package.py"]) try: _ = upload_addon_zip("tests/resources/addon/package/tests-1.0.0.zip") trigger_server_restart() # need to wait at least 0.1 sec. to restart server + last_check = time.time() time.sleep(0.5) while True: try: addons = get_addons_info()["addons"] break except exceptions.ServerError as exc: - assert "Connection timed out" in str(exc) + pass + + if time.time() - last_check > 60: + assert False, "Server timeout" + time.sleep(0.5) assert any(addon_name == addon["name"] for addon in addons)