Skip to content

Commit 68a42a2

Browse files
authored
test: Stabilize FeedsClient integration tests (#95)
1 parent cd3f26e commit 68a42a2

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

nisystemlink/clients/feeds/_feeds_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
from nisystemlink.clients import core
66
from nisystemlink.clients.core._uplink._base_client import BaseClient
77
from nisystemlink.clients.core._uplink._methods import delete, get, post
8-
from uplink import Part, Path, Query
8+
from uplink import Part, Path, Query, retry
99

1010
from . import models
1111

1212

13+
@retry(when=retry.when.status(429), stop=retry.stop.after_attempt(5))
1314
class FeedsClient(BaseClient):
1415
def __init__(self, configuration: Optional[core.HttpConfiguration] = None):
1516
"""Initialize an instance.

tests/integration/feeds/test_feeds_client.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Integration tests for FeedsClient."""
22

3+
import uuid
34
from pathlib import Path
45
from random import randint
56
from typing import BinaryIO, Callable
@@ -9,13 +10,13 @@
910
from nisystemlink.clients.feeds import FeedsClient
1011
from nisystemlink.clients.feeds.models import CreateFeedRequest, Platform
1112

12-
1313
FEED_DESCRIPTION = "Sample feed for uploading packages"
1414
PACKAGE_PATH = str(
1515
Path(__file__).parent.resolve()
1616
/ "test_files"
1717
/ "sample-measurement_0.5.0_windows_x64.nipkg"
1818
)
19+
PREFIX = "Feeds Client Test - "
1920

2021

2122
@pytest.fixture(scope="class")
@@ -73,13 +74,11 @@ def invalid_id() -> str:
7374
@pytest.fixture(scope="class")
7475
def get_feed_name():
7576
"""Generate a feed name."""
76-
name = "testfeed_"
77-
feed_count = 0
7877

7978
def _get_feed_name():
80-
nonlocal feed_count
81-
feed_count += 1
82-
feed_name = name + str(feed_count)
79+
uuid_part = uuid.uuid4().hex
80+
feed_name = f"{PREFIX}{uuid_part}"
81+
8382
return feed_name
8483

8584
yield _get_feed_name

0 commit comments

Comments
 (0)