Skip to content
This repository was archived by the owner on Sep 25, 2025. It is now read-only.

Commit c03f462

Browse files
committed
Rewrite the test systems and test the new endpoints
1 parent 0f57424 commit c03f462

5 files changed

Lines changed: 457 additions & 490 deletions

File tree

tests/conftest.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# Copyright 2023-2025 Robert-André Mauchin
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
import asyncio
19+
import pytest
20+
import pytest_asyncio
21+
from pydepsdev.api import DepsdevAPI
22+
23+
24+
@pytest_asyncio.fixture(autouse=True)
25+
def no_sleep(monkeypatch):
26+
"""
27+
Stub out asyncio.sleep so that our retry/backoff loops don’t actually wait.
28+
"""
29+
30+
async def dummy_sleep(*args, **kwargs):
31+
return None
32+
33+
monkeypatch.setattr(asyncio, "sleep", dummy_sleep)
34+
35+
36+
@pytest_asyncio.fixture
37+
async def api_client():
38+
"""
39+
Provides a DepsdevAPI client with zero backoff (fast tests)
40+
and closes it automatically at teardown.
41+
"""
42+
client = DepsdevAPI(
43+
timeout_duration=0.1,
44+
max_retries=2,
45+
base_backoff=0,
46+
max_backoff=0,
47+
)
48+
yield client
49+
await client.close()

0 commit comments

Comments
 (0)