Skip to content

Commit e379f00

Browse files
committed
unify test timeouts and arguments
1 parent 7c6772e commit e379f00

4 files changed

Lines changed: 23 additions & 5 deletions

File tree

packages/python-sdk/pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ markers =
55

66
asyncio_mode=auto
77
addopts = "--import-mode=importlib"
8-
timeout = 300
8+
timeout = 30
99
filterwarnings =
1010
ignore:'asyncio\.iscoroutinefunction' is deprecated.*:DeprecationWarning:pytest_asyncio\.plugin
1111
ignore:'asyncio\.get_event_loop_policy' is deprecated.*:DeprecationWarning:pytest_asyncio\.plugin
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import os
2+
3+
import pytest
4+
5+
_DIR = os.path.dirname(os.path.abspath(__file__))
6+
7+
8+
def pytest_collection_modifyitems(items):
9+
for item in items:
10+
if str(item.fspath).startswith(_DIR):
11+
item.add_marker(pytest.mark.timeout(180))

packages/python-sdk/tests/conftest.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ def template():
4141
@pytest.fixture()
4242
def sandbox_factory(request, template, sandbox_test_id):
4343
def factory(*, template_name: str = template, **kwargs):
44-
kwargs.setdefault("timeout", 5)
45-
4644
metadata = kwargs.setdefault("metadata", dict())
4745
metadata.setdefault("sandbox_test_id", sandbox_test_id)
4846

@@ -80,8 +78,6 @@ def event_loop():
8078
@pytest.fixture
8179
def async_sandbox_factory(request, template, sandbox_test_id, event_loop):
8280
async def factory(*, template_name: str = template, **kwargs):
83-
kwargs.setdefault("timeout", 5)
84-
8581
metadata = kwargs.setdefault("metadata", dict())
8682
metadata.setdefault("sandbox_test_id", sandbox_test_id)
8783

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import os
2+
3+
import pytest
4+
5+
_DIR = os.path.dirname(os.path.abspath(__file__))
6+
7+
8+
def pytest_collection_modifyitems(items):
9+
for item in items:
10+
if str(item.fspath).startswith(_DIR):
11+
item.add_marker(pytest.mark.timeout(180))

0 commit comments

Comments
 (0)