@@ -227,10 +227,18 @@ def test_fails_to_create_destination_empty_required_fields(test_linode_client: L
227227def test_fails_to_create_stream_invalid_destination (test_linode_client : LinodeClient ):
228228 """
229229 Test that creating a stream with a non-existent destination ID results in a 400 ApiError.
230- Requires no other streams to be present per account
230+ Requires no other streams to be present on account. If a stream is already present test is skipped.
231231 """
232232 from linode_api4 .errors import ApiError
233233
234+ existing_streams = test_linode_client .monitor .streams ()
235+ if len (existing_streams ) > 0 :
236+ stream_ids = [s .id for s in existing_streams ]
237+ pytest .skip (
238+ f"Skipping: existing stream(s) found on this account "
239+ f"(ID: { stream_ids } ). Only one stream can be present per account. "
240+ )
241+
234242 with pytest .raises (ApiError ) as excinfo :
235243 test_linode_client .monitor .stream_create (
236244 label = get_test_label (),
@@ -332,13 +340,11 @@ def test_update_stream_label(test_linode_client: LinodeClient, test_stream_activ
332340
333341 stream .label = new_label
334342 result = stream .save ()
335-
336343 assert result is True
337344
338- updated = test_linode_client .load (LogsStream , test_stream_active .id )
339- assert updated .label == new_label
340-
341345 try :
346+ updated = test_linode_client .load (LogsStream , test_stream_active .id )
347+ assert updated .label == new_label
342348 history = updated .history
343349 snapshot_original = next (h for h in history if h .version == version_before )
344350 snapshot_updated = next (h for h in history if h .version == updated .version )
@@ -348,8 +354,8 @@ def test_update_stream_label(test_linode_client: LinodeClient, test_stream_activ
348354 assert snapshot_updated .id == test_stream_active .id
349355 finally :
350356 # Revert to original label
351- updated .label = original_label
352- updated .save ()
357+ stream .label = original_label
358+ stream .save ()
353359
354360
355361@pytest .mark .skipif (
0 commit comments