mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
parent
777facc69c
commit
2167671d8e
6 changed files with 36 additions and 17 deletions
|
|
@ -268,13 +268,19 @@ class PypeCommands:
|
|||
"""
|
||||
print("run_tests")
|
||||
import subprocess
|
||||
folder = folder or "../tests"
|
||||
|
||||
if folder:
|
||||
folder = " ".join(list(folder))
|
||||
else:
|
||||
folder = "../tests"
|
||||
|
||||
mark_str = pyargs_str = ''
|
||||
if mark:
|
||||
mark_str = "- m {}".format(mark)
|
||||
mark_str = "-m {}".format(mark)
|
||||
|
||||
if pyargs:
|
||||
pyargs_str = "--pyargs {}".format(pyargs)
|
||||
|
||||
subprocess.run("pytest {} {} {}".format(folder, mark_str, pyargs_str))
|
||||
|
||||
cmd = "pytest {} {} {}".format(folder, mark_str, pyargs_str)
|
||||
print("Running {}".format(cmd))
|
||||
subprocess.run(cmd)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Automatic tests for OpenPype
|
||||
============================
|
||||
Structure:
|
||||
- integration - end to end tests, slow
|
||||
- integration - end to end tests, slow (see README.md in the integration folder for more info)
|
||||
- openpype/modules/MODULE_NAME - structure follow directory structure in code base
|
||||
- fixture - sample data `(MongoDB dumps, test files etc.)`
|
||||
- `tests.py` - single or more pytest files for MODULE_NAME
|
||||
|
|
@ -10,3 +10,16 @@ Structure:
|
|||
- fixture
|
||||
- `tests.py`
|
||||
|
||||
How to run:
|
||||
----------
|
||||
- single test class could be run by PyCharm and its pytest runner directly
|
||||
- OR
|
||||
- use Openpype command 'runtests' from command line
|
||||
-- `${OPENPYPE_ROOT}/start.py runtests`
|
||||
|
||||
By default, this command will run all tests in ${OPENPYPE_ROOT}/tests.
|
||||
|
||||
Specific location could be provided to this command as an argument, either as absolute path, or relative path to ${OPENPYPE_ROOT}.
|
||||
(eg. `${OPENPYPE_ROOT}/start.py runtests ../tests/integration`) will trigger only tests in `integration` folder.
|
||||
|
||||
See `${OPENPYPE_ROOT}/cli.py:runtests` for other arguments.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import pytest
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
import glob
|
||||
|
||||
from tests.lib.testing_classes import PublishTest
|
||||
|
||||
|
|
|
|||
|
|
@ -193,11 +193,10 @@ class RemoteFileHandler:
|
|||
urllib.request.Request(url,
|
||||
headers={"User-Agent": USER_AGENT})) \
|
||||
as response:
|
||||
for chunk in iter(lambda: response.read(chunk_size),
|
||||
""):
|
||||
if not chunk:
|
||||
break
|
||||
fh.write(chunk)
|
||||
for chunk in iter(lambda: response.read(chunk_size), ""):
|
||||
if not chunk:
|
||||
break
|
||||
fh.write(chunk)
|
||||
|
||||
@staticmethod
|
||||
def _get_redirect_url(url, max_hops):
|
||||
|
|
@ -218,7 +217,7 @@ class RemoteFileHandler:
|
|||
)
|
||||
|
||||
@staticmethod
|
||||
def _get_confirm_token(response): # type: ignore[name-defined]
|
||||
def _get_confirm_token(response):
|
||||
for key, value in response.cookies.items():
|
||||
if key.startswith('download_warning'):
|
||||
return value
|
||||
|
|
@ -227,7 +226,7 @@ class RemoteFileHandler:
|
|||
|
||||
@staticmethod
|
||||
def _save_response_content(
|
||||
response_gen, destination, # type: ignore[name-defined]
|
||||
response_gen, destination,
|
||||
):
|
||||
with open(destination, "wb") as f:
|
||||
pbar = enlighten.Counter(
|
||||
|
|
@ -241,7 +240,7 @@ class RemoteFileHandler:
|
|||
pbar.close()
|
||||
|
||||
@staticmethod
|
||||
def _quota_exceeded(first_chunk): # type: ignore[name-defined]
|
||||
def _quota_exceeded(first_chunk):
|
||||
try:
|
||||
return "Google Drive - Quota exceeded" in first_chunk.decode()
|
||||
except UnicodeDecodeError:
|
||||
|
|
|
|||
|
|
@ -260,4 +260,4 @@ class PublishTest(ModuleUnitTest):
|
|||
f != expected_dir_base and os.path.exists(f))
|
||||
|
||||
not_matched = expected.difference(published)
|
||||
assert not not_matched, "Missing {} files".format(not_matched)
|
||||
assert not not_matched, "Missing {} files".format(not_matched)
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ class TestSiteOperation(ModuleUnitTest):
|
|||
|
||||
REPRESENTATION_ID = "60e578d0c987036c6a7b741d"
|
||||
|
||||
TEST_FILES = [("1eCwPljuJeOI8A3aisfOIBKKjcmIycTEt",
|
||||
"test_site_operations.zip", '')]
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def setup_sync_server_module(self, dbcon):
|
||||
"""Get sync_server_module from ModulesManager"""
|
||||
|
|
@ -109,7 +112,7 @@ class TestSiteOperation(ModuleUnitTest):
|
|||
site_names = [site["name"] for site in ret["files"][0]["sites"]]
|
||||
|
||||
assert 'test_site' not in site_names, "Site name wasn't removed"
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("setup_sync_server_module")
|
||||
def test_remove_site_again(self, dbcon, setup_sync_server_module):
|
||||
"""Depends on test_add_site, must trow exception"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue