@@ -565,23 +565,31 @@ def remove_implicit_resolver(cls, tag_to_remove):
565
565
yaml .load_all (package_zip .read (yaml_file ), Loader = NoDatesSafeLoader )
566
566
)
567
567
568
- # Each file may have a "test" named 'setup' or 'teardown',
569
- # these sets of steps should be run at the beginning and end
570
- # of every other test within the file so we do one pass to capture those.
571
- setup_steps = teardown_steps = None
568
+ # Each file has a `requires` section with `serverless` and `stack`
569
+ # boolean entries indicating whether the test should run with
570
+ # serverless, stack or both. Additionally, each file may have a section
571
+ # named 'setup' or 'teardown', these sets of steps should be run at the
572
+ # beginning and end of every other test within the file so we do one
573
+ # pass to capture those.
574
+ requires = setup_steps = teardown_steps = None
572
575
test_numbers_and_steps = []
573
576
test_number = 0
574
577
575
578
for yaml_test in yaml_tests :
576
579
test_name , test_step = yaml_test .popitem ()
577
- if test_name == "setup" :
580
+ if test_name == "requires" :
581
+ requires = test_step
582
+ elif test_name == "setup" :
578
583
setup_steps = test_step
579
584
elif test_name == "teardown" :
580
585
teardown_steps = test_step
581
586
else :
582
587
test_numbers_and_steps .append ((test_number , test_step ))
583
588
test_number += 1
584
589
590
+ if not requires ["serverless" ]:
591
+ continue
592
+
585
593
# Now we combine setup, teardown, and test_steps into
586
594
# a set of pytest.param() instances
587
595
for test_number , test_step in test_numbers_and_steps :
0 commit comments