Skip to content

Commit 3c5b586

Browse files
committed
code cleanup
1 parent 3b7d78d commit 3c5b586

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

test/unit/test_http_retries.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,30 @@ def groundlight_fixture() -> Groundlight:
2020
return gl
2121

2222

23-
@pytest.fixture(name="retry_detector_name")
24-
def retry_detector_name_fixture(detector_name) -> str:
25-
return detector_name("test detector")
26-
27-
2823
@pytest.fixture(name="detector")
29-
def detector_fixture(gl: Groundlight, retry_detector_name: str) -> Detector:
24+
def detector_fixture(gl: Groundlight, detector_name: Callable) -> Detector:
3025
return gl.get_or_create_detector(
31-
name=retry_detector_name, query="Is there a dog?", confidence_threshold=DEFAULT_CONFIDENCE_THRESHOLD
26+
name=detector_name(), query="Is there a dog?", confidence_threshold=DEFAULT_CONFIDENCE_THRESHOLD
3227
)
3328

3429

35-
def test_create_detector_attempts_retries(gl: Groundlight, retry_detector_name: str):
30+
def test_create_detector_attempts_retries(gl: Groundlight, detector_name: Callable):
3631
run_test(
3732
mocked_call="urllib3.PoolManager.request",
3833
api_method=gl.create_detector,
3934
expected_call_counts=TOTAL_RETRIES + 1,
40-
name=retry_detector_name,
35+
name=detector_name(),
4136
query="Is there a dog?",
4237
confidence_threshold=DEFAULT_CONFIDENCE_THRESHOLD,
4338
)
4439

4540

46-
def test_get_or_create_detector_attempts_retries(gl: Groundlight, retry_detector_name: str):
41+
def test_get_or_create_detector_attempts_retries(gl: Groundlight, detector_name: Callable):
4742
run_test(
4843
mocked_call="requests.request",
4944
api_method=gl.get_or_create_detector,
5045
expected_call_counts=TOTAL_RETRIES + 1,
51-
name=retry_detector_name,
46+
name=detector_name(),
5247
query="Is there a dog?",
5348
confidence_threshold=DEFAULT_CONFIDENCE_THRESHOLD,
5449
)
@@ -63,12 +58,12 @@ def test_get_detector_attempts_retries(gl: Groundlight, detector: Detector):
6358
)
6459

6560

66-
def test_get_detector_by_name_attempts_retries(gl: Groundlight, retry_detector_name: str):
61+
def test_get_detector_by_name_attempts_retries(gl: Groundlight, detector_name: Callable):
6762
run_test(
6863
mocked_call="requests.request",
6964
api_method=gl.get_detector_by_name,
7065
expected_call_counts=TOTAL_RETRIES + 1,
71-
name=retry_detector_name,
66+
name=detector_name(),
7267
)
7368

7469

@@ -78,12 +73,12 @@ def test_list_detectors_attempts_retries(gl: Groundlight):
7873
)
7974

8075

81-
def test_submit_image_query_attempts_retries(gl: Groundlight, retry_detector_name: str):
76+
def test_submit_image_query_attempts_retries(gl: Groundlight, detector_name: Callable):
8277
run_test(
8378
mocked_call="urllib3.PoolManager.request",
8479
api_method=gl.submit_image_query,
8580
expected_call_counts=TOTAL_RETRIES + 1,
86-
detector=retry_detector_name,
81+
detector=detector_name(),
8782
image=IMAGE_FILE,
8883
wait=1,
8984
)

0 commit comments

Comments
 (0)