@@ -32,6 +32,7 @@ def test_log_metrics(
32
32
overload_buffer : bool ,
33
33
setup_logging : "CountingLogHandler" ,
34
34
mocker ,
35
+ request : pytest .FixtureRequest ,
35
36
visibility : typing .Union [typing .Literal ["public" , "tenant" ], list [str ], None ]
36
37
) -> None :
37
38
METRICS = {"a" : 10 , "b" : 1.2 }
@@ -47,7 +48,7 @@ def test_log_metrics(
47
48
with pytest .raises (RuntimeError ):
48
49
run .init (
49
50
name = f"test_run_{ str (uuid .uuid4 ()).split ('-' , 1 )[0 ]} " ,
50
- tags = ["simvue_client_unit_tests" ],
51
+ tags = ["simvue_client_unit_tests" , request . node . name ],
51
52
folder = "/simvue_unit_testing" ,
52
53
retention_period = "1 hour" ,
53
54
visibility = visibility ,
@@ -57,15 +58,13 @@ def test_log_metrics(
57
58
58
59
run .init (
59
60
name = f"test_run_{ str (uuid .uuid4 ()).split ('-' , 1 )[0 ]} " ,
60
- tags = ["simvue_client_unit_tests" ],
61
+ tags = ["simvue_client_unit_tests" , request . node . name ],
61
62
folder = "/simvue_unit_testing" ,
62
63
visibility = visibility ,
63
64
resources_metrics_interval = 1 ,
64
65
retention_period = "1 hour" ,
65
66
)
66
67
67
- run .update_tags (["simvue_client_unit_tests" , "test_log_metrics" ])
68
-
69
68
# Speed up the read rate for this test
70
69
run ._dispatcher ._max_buffer_size = 10
71
70
run ._dispatcher ._max_read_rate *= 10
@@ -110,31 +109,27 @@ def test_log_metrics(
110
109
def test_log_metrics_offline (create_test_run_offline : tuple [sv_run .Run , dict ]) -> None :
111
110
METRICS = {"a" : 10 , "b" : 1.2 , "c" : 2 }
112
111
run , _ = create_test_run_offline
113
- run .update_tags (["simvue_client_unit_tests" , "test_log_metrics" ])
114
112
run .log_metrics (METRICS )
115
113
116
114
117
115
@pytest .mark .run
118
116
def test_log_events (create_test_run : tuple [sv_run .Run , dict ]) -> None :
119
117
EVENT_MSG = "Hello world!"
120
118
run , _ = create_test_run
121
- run .update_tags (["simvue_client_unit_tests" , "test_log_events" ])
122
119
run .log_event (EVENT_MSG )
123
120
124
121
125
122
@pytest .mark .run
126
123
def test_log_events_offline (create_test_run_offline : tuple [sv_run .Run , dict ]) -> None :
127
124
EVENT_MSG = "Hello world!"
128
125
run , _ = create_test_run_offline
129
- run .update_tags (["simvue_client_unit_tests" , "test_log_events" ])
130
126
run .log_event (EVENT_MSG )
131
127
132
128
133
129
@pytest .mark .run
134
130
def test_update_metadata (create_test_run : tuple [sv_run .Run , dict ]) -> None :
135
131
METADATA = {"a" : 10 , "b" : 1.2 , "c" : "word" }
136
132
run , _ = create_test_run
137
- run .update_tags (["simvue_client_unit_tests" , "test_update_metadata" ])
138
133
run .update_metadata (METADATA )
139
134
140
135
@@ -144,13 +139,12 @@ def test_update_metadata_offline(
144
139
) -> None :
145
140
METADATA = {"a" : 10 , "b" : 1.2 , "c" : "word" }
146
141
run , _ = create_test_run_offline
147
- run .update_tags (["simvue_client_unit_tests" , "test_update_metadata" ])
148
142
run .update_metadata (METADATA )
149
143
150
144
151
145
@pytest .mark .run
152
146
@pytest .mark .parametrize ("multi_threaded" , (True , False ), ids = ("multi" , "single" ))
153
- def test_runs_multiple_parallel (multi_threaded : bool ) -> None :
147
+ def test_runs_multiple_parallel (multi_threaded : bool , request : pytest . FixtureRequest ) -> None :
154
148
N_RUNS : int = 2
155
149
if multi_threaded :
156
150
@@ -159,7 +153,7 @@ def thread_func(index: int) -> tuple[int, list[dict[str, typing.Any]], str]:
159
153
run .config (suppress_errors = False )
160
154
run .init (
161
155
name = f"test_runs_multiple_{ index + 1 } " ,
162
- tags = ["simvue_client_unit_tests" , "test_multi_run_threaded" ],
156
+ tags = ["simvue_client_unit_tests" , request . node . name ],
163
157
folder = "/simvue_unit_testing" ,
164
158
retention_period = "1 hour" ,
165
159
)
@@ -196,7 +190,7 @@ def thread_func(index: int) -> tuple[int, list[dict[str, typing.Any]], str]:
196
190
run_1 .config (suppress_errors = False )
197
191
run_1 .init (
198
192
name = "test_runs_multiple_unthreaded_1" ,
199
- tags = ["simvue_client_unit_tests" , "test_multi_run_unthreaded" ],
193
+ tags = ["simvue_client_unit_tests" , request . node . name ],
200
194
folder = "/simvue_unit_testing" ,
201
195
retention_period = "1 hour" ,
202
196
)
@@ -238,7 +232,7 @@ def thread_func(index: int) -> tuple[int, list[dict[str, typing.Any]], str]:
238
232
239
233
240
234
@pytest .mark .run
241
- def test_runs_multiple_series () -> None :
235
+ def test_runs_multiple_series (request : pytest . FixtureRequest ) -> None :
242
236
N_RUNS : int = 2
243
237
244
238
metrics = []
@@ -250,7 +244,7 @@ def test_runs_multiple_series() -> None:
250
244
run .config (suppress_errors = False )
251
245
run .init (
252
246
name = f"test_runs_multiple_series_{ index } " ,
253
- tags = ["simvue_client_unit_tests" , "test_multi_run_series" ],
247
+ tags = ["simvue_client_unit_tests" , request . node . name ],
254
248
folder = "/simvue_unit_testing" ,
255
249
retention_period = "1 hour" ,
256
250
)
@@ -284,7 +278,7 @@ def test_runs_multiple_series() -> None:
284
278
@pytest .mark .run
285
279
@pytest .mark .parametrize ("post_init" , (True , False ), ids = ("pre-init" , "post-init" ))
286
280
def test_suppressed_errors (
287
- setup_logging : "CountingLogHandler" , post_init : bool
281
+ setup_logging : "CountingLogHandler" , post_init : bool , request : pytest . FixtureRequest
288
282
) -> None :
289
283
setup_logging .captures = ["Skipping call to" ]
290
284
@@ -300,7 +294,7 @@ def test_suppressed_errors(
300
294
run .init (
301
295
name = "test_suppressed_errors" ,
302
296
folder = "/simvue_unit_testing" ,
303
- tags = ["simvue_client_unit_tests" ],
297
+ tags = ["simvue_client_unit_tests" , request . node . name ],
304
298
retention_period = "1 hour"
305
299
)
306
300
@@ -323,11 +317,11 @@ def test_bad_run_arguments() -> None:
323
317
run .init ("sdas" , [34 ])
324
318
325
319
326
- def test_set_folder_details () -> None :
320
+ def test_set_folder_details (request : pytest . FixtureRequest ) -> None :
327
321
with sv_run .Run () as run :
328
- folder_name : str = "/simvue_unit_test_folder "
322
+ folder_name : str = "/simvue_unit_tests "
329
323
description : str = "test description"
330
- tags : list [str ] = ["simvue_client_unit_tests" , "test_set_folder_details" ]
324
+ tags : list [str ] = ["simvue_client_unit_tests" , request . node . name ]
331
325
run .init (folder = folder_name )
332
326
run .set_folder_details (path = folder_name , tags = tags , description = description )
333
327
0 commit comments