Skip to content

Commit

Permalink
run create package automatically and wait for 60 for server to restart
Browse files Browse the repository at this point in the history
  • Loading branch information
iLLiCiTiT committed Dec 2, 2024
1 parent e985e57 commit 67410a1
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 67410a1

Please sign in to comment.