Skip to content

Commit d16decf

Browse files
Merge pull request #2865 from VWS-Python/keyword-only-test-params
Use keyword-only parameters in tests
2 parents d81e5ac + 253bbea commit d16decf

File tree

4 files changed

+39
-6
lines changed

4 files changed

+39
-6
lines changed

tests/test_cloud_reco_exceptions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525

2626
def test_too_many_max_results(
27+
*,
2728
cloud_reco_client: CloudRecoService,
2829
high_quality_image: io.BytesIO,
2930
) -> None:
@@ -45,6 +46,7 @@ def test_too_many_max_results(
4546

4647

4748
def test_image_too_large(
49+
*,
4850
cloud_reco_client: CloudRecoService,
4951
png_too_large: io.BytesIO | io.BufferedRandom,
5052
) -> None:

tests/test_query.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class TestQuery:
2020

2121
@staticmethod
2222
def test_no_matches(
23+
*,
2324
cloud_reco_client: CloudRecoService,
2425
image: io.BytesIO | BinaryIO,
2526
) -> None:
@@ -29,6 +30,7 @@ def test_no_matches(
2930

3031
@staticmethod
3132
def test_match(
33+
*,
3234
vws_client: VWS,
3335
cloud_reco_client: CloudRecoService,
3436
image: io.BytesIO | BinaryIO,
@@ -55,8 +57,8 @@ class TestDefaultRequestTimeout:
5557
argvalues=[(29, False), (31, True)],
5658
)
5759
def test_default_timeout(
58-
image: io.BytesIO | BinaryIO,
5960
*,
61+
image: io.BytesIO | BinaryIO,
6062
response_delay_seconds: int,
6163
expect_timeout: bool,
6264
) -> None:
@@ -110,8 +112,8 @@ class TestCustomRequestTimeout:
110112
],
111113
)
112114
def test_custom_timeout(
113-
image: io.BytesIO | BinaryIO,
114115
*,
116+
image: io.BytesIO | BinaryIO,
115117
custom_timeout: float | tuple[float, float],
116118
response_delay_seconds: float,
117119
expect_timeout: bool,
@@ -194,6 +196,7 @@ class TestMaxNumResults:
194196

195197
@staticmethod
196198
def test_default(
199+
*,
197200
vws_client: VWS,
198201
cloud_reco_client: CloudRecoService,
199202
image: io.BytesIO | BinaryIO,
@@ -220,6 +223,7 @@ def test_default(
220223

221224
@staticmethod
222225
def test_custom(
226+
*,
223227
vws_client: VWS,
224228
cloud_reco_client: CloudRecoService,
225229
image: io.BytesIO | BinaryIO,
@@ -262,6 +266,7 @@ class TestIncludeTargetData:
262266

263267
@staticmethod
264268
def test_default(
269+
*,
265270
vws_client: VWS,
266271
cloud_reco_client: CloudRecoService,
267272
image: io.BytesIO | BinaryIO,
@@ -292,6 +297,7 @@ def test_default(
292297

293298
@staticmethod
294299
def test_top(
300+
*,
295301
vws_client: VWS,
296302
cloud_reco_client: CloudRecoService,
297303
image: io.BytesIO | BinaryIO,
@@ -327,6 +333,7 @@ def test_top(
327333

328334
@staticmethod
329335
def test_none(
336+
*,
330337
vws_client: VWS,
331338
cloud_reco_client: CloudRecoService,
332339
image: io.BytesIO | BinaryIO,
@@ -363,6 +370,7 @@ def test_none(
363370

364371
@staticmethod
365372
def test_all(
373+
*,
366374
vws_client: VWS,
367375
cloud_reco_client: CloudRecoService,
368376
image: io.BytesIO | BinaryIO,

tests/test_vws.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ class TestAddTarget:
3434
)
3535
@pytest.mark.parametrize(argnames="active_flag", argvalues=[True, False])
3636
def test_add_target(
37+
*,
3738
vws_client: VWS,
3839
image: io.BytesIO | BinaryIO,
3940
application_metadata: bytes | None,
4041
cloud_reco_client: CloudRecoService,
41-
*,
4242
active_flag: bool,
4343
) -> None:
4444
"""No exception is raised when adding one target."""
@@ -76,6 +76,7 @@ def test_add_target(
7676

7777
@staticmethod
7878
def test_add_two_targets(
79+
*,
7980
vws_client: VWS,
8081
image: io.BytesIO | BinaryIO,
8182
) -> None:
@@ -103,8 +104,8 @@ class TestDefaultRequestTimeout:
103104
argvalues=[(29, False), (31, True)],
104105
)
105106
def test_default_timeout(
106-
image: io.BytesIO | BinaryIO,
107107
*,
108+
image: io.BytesIO | BinaryIO,
108109
response_delay_seconds: int,
109110
expect_timeout: bool,
110111
) -> None:
@@ -169,8 +170,8 @@ class TestCustomRequestTimeout:
169170
],
170171
)
171172
def test_custom_timeout(
172-
image: io.BytesIO | BinaryIO,
173173
*,
174+
image: io.BytesIO | BinaryIO,
174175
custom_timeout: float | tuple[float, float],
175176
response_delay_seconds: float,
176177
expect_timeout: bool,
@@ -251,6 +252,7 @@ class TestListTargets:
251252

252253
@staticmethod
253254
def test_list_targets(
255+
*,
254256
vws_client: VWS,
255257
image: io.BytesIO | BinaryIO,
256258
) -> None:
@@ -277,6 +279,7 @@ class TestDelete:
277279

278280
@staticmethod
279281
def test_delete_target(
282+
*,
280283
vws_client: VWS,
281284
image: io.BytesIO | BinaryIO,
282285
) -> None:
@@ -300,6 +303,7 @@ class TestGetTargetSummaryReport:
300303

301304
@staticmethod
302305
def test_get_target_summary_report(
306+
*,
303307
vws_client: VWS,
304308
image: io.BytesIO | BinaryIO,
305309
) -> None:
@@ -398,6 +402,7 @@ class TestGetTargetRecord:
398402

399403
@staticmethod
400404
def test_get_target_record(
405+
*,
401406
vws_client: VWS,
402407
image: io.BytesIO | BinaryIO,
403408
) -> None:
@@ -444,6 +449,7 @@ def test_get_target_record(
444449

445450
@staticmethod
446451
def test_get_failed(
452+
*,
447453
vws_client: VWS,
448454
image_file_failed_state: io.BytesIO,
449455
) -> None:
@@ -467,6 +473,7 @@ class TestWaitForTargetProcessed:
467473

468474
@staticmethod
469475
def test_wait_for_target_processed(
476+
*,
470477
vws_client: VWS,
471478
image: io.BytesIO | BinaryIO,
472479
) -> None:
@@ -628,6 +635,7 @@ class TestGetDuplicateTargets:
628635

629636
@staticmethod
630637
def test_get_duplicate_targets(
638+
*,
631639
vws_client: VWS,
632640
image: io.BytesIO | BinaryIO,
633641
) -> None:
@@ -658,6 +666,7 @@ class TestUpdateTarget:
658666

659667
@staticmethod
660668
def test_update_target(
669+
*,
661670
vws_client: VWS,
662671
image: io.BytesIO | BinaryIO,
663672
different_high_quality_image: io.BytesIO,
@@ -717,6 +726,7 @@ def test_update_target(
717726

718727
@staticmethod
719728
def test_no_fields_given(
729+
*,
720730
vws_client: VWS,
721731
image: io.BytesIO | BinaryIO,
722732
) -> None:
@@ -745,6 +755,7 @@ class TestGenerateVumarkInstance:
745755
],
746756
)
747757
def test_generate_vumark_instance(
758+
*,
748759
vumark_service_client: VuMarkService,
749760
vumark_target_id: str,
750761
accept: VuMarkAccept,

tests/test_vws_exceptions.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242

4343
def test_image_too_large(
44+
*,
4445
vws_client: VWS,
4546
png_too_large: io.BytesIO | io.BufferedRandom,
4647
) -> None:
@@ -75,7 +76,11 @@ def test_invalid_given_id(vws_client: VWS) -> None:
7576
assert exc.value.target_id == target_id
7677

7778

78-
def test_add_bad_name(vws_client: VWS, high_quality_image: io.BytesIO) -> None:
79+
def test_add_bad_name(
80+
*,
81+
vws_client: VWS,
82+
high_quality_image: io.BytesIO,
83+
) -> None:
7984
"""
8085
When a name with a bad character is given, a ``ServerError``
8186
exception
@@ -143,6 +148,7 @@ def test_bad_image(vws_client: VWS) -> None:
143148

144149

145150
def test_target_name_exist(
151+
*,
146152
vws_client: VWS,
147153
high_quality_image: io.BytesIO,
148154
) -> None:
@@ -201,6 +207,7 @@ def test_project_inactive(
201207

202208

203209
def test_target_status_processing(
210+
*,
204211
vws_client: VWS,
205212
high_quality_image: io.BytesIO,
206213
) -> None:
@@ -225,6 +232,7 @@ def test_target_status_processing(
225232

226233

227234
def test_metadata_too_large(
235+
*,
228236
vws_client: VWS,
229237
high_quality_image: io.BytesIO,
230238
) -> None:
@@ -246,6 +254,7 @@ def test_metadata_too_large(
246254

247255

248256
def test_request_time_too_skewed(
257+
*,
249258
vws_client: VWS,
250259
high_quality_image: io.BytesIO,
251260
) -> None:
@@ -316,6 +325,7 @@ def test_authentication_failure(
316325

317326

318327
def test_target_status_not_success(
328+
*,
319329
vws_client: VWS,
320330
high_quality_image: io.BytesIO,
321331
) -> None:
@@ -368,6 +378,7 @@ def test_vwsexception_inheritance() -> None:
368378

369379

370380
def test_invalid_instance_id(
381+
*,
371382
vumark_service_client: VuMarkService,
372383
vumark_target_id: str,
373384
) -> None:
@@ -423,6 +434,7 @@ def test_invalid_target_type(
423434

424435

425436
def test_base_exception(
437+
*,
426438
vws_client: VWS,
427439
high_quality_image: io.BytesIO,
428440
) -> None:

0 commit comments

Comments
 (0)