2828
2929
3030# Backups
31- @pytest .fixture (scope = "session " )
31+ @pytest .fixture (scope = "module " )
3232def linode_basic_with_firewall (linode_cloud_firewall ):
3333 linode_id = create_linode (firewall_id = linode_cloud_firewall )
3434
@@ -37,7 +37,7 @@ def linode_basic_with_firewall(linode_cloud_firewall):
3737 delete_target_id ("linodes" , linode_id )
3838
3939
40- @pytest .fixture (scope = "session " )
40+ @pytest .fixture (scope = "module " )
4141def linode_backup_enabled (linode_cloud_firewall ):
4242 # create linode with backups enabled
4343 linode_id = exec_test_command (
@@ -68,7 +68,7 @@ def linode_backup_enabled(linode_cloud_firewall):
6868 delete_target_id ("linodes" , linode_id )
6969
7070
71- @pytest .fixture
71+ @pytest .fixture ( scope = "module" )
7272def linode_backup_disabled (linode_cloud_firewall ):
7373 res = set_backups_enabled_in_account_settings (toggle = False )
7474
@@ -84,7 +84,7 @@ def linode_backup_disabled(linode_cloud_firewall):
8484 delete_target_id ("linodes" , linode_id )
8585
8686
87- @pytest .fixture
87+ @pytest .fixture ( scope = "module" )
8888def snapshot_of_linode ():
8989 # get linode id after creation and wait for "running" status
9090 linode_id = create_linode_and_wait ()
@@ -116,7 +116,7 @@ def snapshot_of_linode():
116116)
117117
118118
119- @pytest .fixture (scope = "session " )
119+ @pytest .fixture (scope = "module " )
120120def linode_instance_config_tests (linode_cloud_firewall ):
121121 linode_id = create_linode (
122122 firewall_id = linode_cloud_firewall ,
@@ -129,7 +129,7 @@ def linode_instance_config_tests(linode_cloud_firewall):
129129 delete_target_id (target = "linodes" , id = linode_id )
130130
131131
132- @pytest .fixture (scope = "session " )
132+ @pytest .fixture (scope = "module " )
133133def linode_disk_config (linode_instance_config_tests ):
134134 linode_id = linode_instance_config_tests
135135
@@ -154,15 +154,15 @@ def linode_disk_config(linode_instance_config_tests):
154154 yield config_id
155155
156156
157- @pytest .fixture (scope = "session " )
157+ @pytest .fixture (scope = "module " )
158158def test_vpc_w_subnet (request ):
159159 vpc_json = create_vpc_w_subnet ()
160160 vpc_id = str (vpc_json ["id" ])
161161
162162 yield vpc_id
163163
164164
165- @pytest .fixture (scope = "session " )
165+ @pytest .fixture (scope = "module " )
166166def cleanup_vpc (request , test_vpc_w_subnet ):
167167 # Register finalizer to delete VPC after the entire session, with a delay
168168 def delayed_cleanup ():
@@ -172,7 +172,7 @@ def delayed_cleanup():
172172 request .addfinalizer (delayed_cleanup )
173173
174174
175- @pytest .fixture (scope = "session " )
175+ @pytest .fixture (scope = "module " )
176176def config_vpc_interface (
177177 linode_instance_config_tests , linode_disk_config , test_vpc_w_subnet
178178):
@@ -241,7 +241,7 @@ def create_vpc_w_subnet():
241241
242242
243243# Disks
244- @pytest .fixture (scope = "session " )
244+ @pytest .fixture (scope = "module " )
245245def linode_instance_disk_tests (linode_cloud_firewall ):
246246 test_region = get_random_region_with_caps (required_capabilities = ["Linodes" ])
247247 linode_id = create_linode_and_wait (
@@ -263,7 +263,7 @@ def linode_instance_disk_tests(linode_cloud_firewall):
263263
264264
265265# Interfaces
266- @pytest .fixture (scope = "session " )
266+ @pytest .fixture (scope = "module " )
267267def linode_with_vpc_interface_as_json (linode_cloud_firewall ):
268268 vpc_json = create_vpc_w_subnet ()
269269
@@ -312,7 +312,7 @@ def linode_with_vpc_interface_as_json(linode_cloud_firewall):
312312
313313
314314# Interfaces new
315- @pytest .fixture (scope = "session " )
315+ @pytest .fixture (scope = "module " )
316316def linode_interface_public (linode_cloud_firewall ):
317317 linode_id = create_linode (
318318 firewall_id = linode_cloud_firewall ,
@@ -323,12 +323,17 @@ def linode_interface_public(linode_cloud_firewall):
323323 + "}]" ,
324324 )
325325
326+ wait_until (linode_id = linode_id , timeout = 300 , status = "running" )
327+
328+ # shutdown linode
329+ wait_until (linode_id = linode_id , timeout = 60 , status = "offline" )
330+
326331 yield linode_id
327332
328333 delete_target_id (target = "linodes" , id = linode_id )
329334
330335
331- @pytest .fixture (scope = "session " )
336+ @pytest .fixture (scope = "module " )
332337def linode_interface_vlan (linode_cloud_firewall ):
333338 linode_id = create_linode (
334339 firewall_id = linode_cloud_firewall ,
@@ -342,7 +347,7 @@ def linode_interface_vlan(linode_cloud_firewall):
342347 delete_target_id (target = "linodes" , id = linode_id )
343348
344349
345- @pytest .fixture (scope = "session " )
350+ @pytest .fixture (scope = "module " )
346351def linode_interface_legacy (linode_cloud_firewall ):
347352 linode_id = create_linode (
348353 firewall_id = linode_cloud_firewall ,
@@ -355,7 +360,7 @@ def linode_interface_legacy(linode_cloud_firewall):
355360 delete_target_id (target = "linodes" , id = linode_id )
356361
357362
358- @pytest .fixture (scope = "session " )
363+ @pytest .fixture (scope = "module " )
359364def linode_interface_vpc (linode_cloud_firewall ):
360365 vpc_output = json .loads (
361366 exec_test_command (
@@ -397,7 +402,7 @@ def linode_interface_vpc(linode_cloud_firewall):
397402
398403
399404# Linodes
400- @pytest .fixture (scope = "session " )
405+ @pytest .fixture (scope = "module " )
401406def test_linode_instance (linode_cloud_firewall ):
402407 linode_label = DEFAULT_LABEL + get_random_text (5 )
403408
@@ -435,7 +440,7 @@ def test_linode_instance(linode_cloud_firewall):
435440
436441
437442# Linode Power Status
438- @pytest .fixture (scope = "session " )
443+ @pytest .fixture (scope = "module " )
439444def linode_instance_basic (linode_cloud_firewall ):
440445 linode_id = create_linode_and_wait (firewall_id = linode_cloud_firewall )
441446
@@ -444,7 +449,7 @@ def linode_instance_basic(linode_cloud_firewall):
444449 delete_target_id (target = "linodes" , id = linode_id )
445450
446451
447- @pytest .fixture (scope = "session " )
452+ @pytest .fixture (scope = "module " )
448453def linode_in_running_state (linode_cloud_firewall ):
449454 linode_id = create_linode_and_wait (firewall_id = linode_cloud_firewall )
450455
@@ -463,7 +468,7 @@ def linode_in_running_state_for_reboot(linode_cloud_firewall):
463468
464469
465470# Rebuild
466- @pytest .fixture (scope = "session " )
471+ @pytest .fixture (scope = "module " )
467472def linode_for_rebuild_tests (linode_cloud_firewall ):
468473 test_region = get_random_region_with_caps (
469474 required_capabilities = ["Linodes" , "Disk Encryption" ]
@@ -480,7 +485,7 @@ def linode_for_rebuild_tests(linode_cloud_firewall):
480485
481486
482487# Resize
483- @pytest .fixture (scope = "session " )
488+ @pytest .fixture (scope = "module " )
484489def linode_instance_for_resize_tests (linode_cloud_firewall ):
485490 plan = exec_test_command (
486491 BASE_CMDS ["linodes" ]
@@ -502,7 +507,7 @@ def linode_instance_for_resize_tests(linode_cloud_firewall):
502507
503508
504509# Linodes
505- @pytest .fixture (scope = "session " )
510+ @pytest .fixture (scope = "module " )
506511def linode_wo_image (linode_cloud_firewall ):
507512 label = get_random_text (5 ) + "-label"
508513 linode_id = exec_test_command (
@@ -532,7 +537,7 @@ def linode_wo_image(linode_cloud_firewall):
532537 delete_target_id (target = "linodes" , id = linode_id )
533538
534539
535- @pytest .fixture (scope = "session " )
540+ @pytest .fixture (scope = "module " )
536541def linode_min_req (linode_cloud_firewall ):
537542 result = exec_test_command (
538543 BASE_CMDS ["linodes" ]
@@ -563,7 +568,7 @@ def linode_min_req(linode_cloud_firewall):
563568 delete_target_id (target = "linodes" , id = linode_id )
564569
565570
566- @pytest .fixture (scope = "session " )
571+ @pytest .fixture (scope = "module " )
567572def linode_with_label (linode_cloud_firewall ):
568573 label = "cli" + get_random_text (5 )
569574 result = exec_test_command (
0 commit comments