File tree Expand file tree Collapse file tree 7 files changed +36
-47
lines changed Expand file tree Collapse file tree 7 files changed +36
-47
lines changed Original file line number Diff line number Diff line change 1
1
import os
2
+ from typing import List
2
3
3
4
import pytest
4
5
@@ -15,18 +16,18 @@ def region():
15
16
16
17
@pytest .fixture ()
17
18
def add_prefs (region : str ):
18
- return [
19
+ return []
20
+
21
+
22
+ @pytest .fixture ()
23
+ def set_prefs (add_prefs : List [tuple [str , str | bool ]], region : str ):
24
+ """Set prefs"""
25
+ prefs = [
19
26
("extensions.formautofill.creditCards.reauth.optout" , False ),
20
27
("extensions.formautofill.reauth.enabled" , False ),
21
28
("browser.aboutConfig.showWarning" , False ),
22
29
("browser.search.region" , region ),
23
30
]
24
-
25
-
26
- @pytest .fixture ()
27
- def set_prefs (add_prefs : dict , region : str ):
28
- """Set prefs"""
29
- prefs = []
30
31
prefs .extend (add_prefs )
31
32
return prefs
32
33
Original file line number Diff line number Diff line change 1
1
{
2
2
"region" : " CA" ,
3
3
"tests" : [
4
- " test_demo_cc_doorhanger_shown_on_valid_credit_card_submission.py" ,
5
- " test_demo_cc_add_new_credit_card.py" ,
6
- " test_demo_ad_doorhanger_shown_on_valid_address_submission.py" ,
7
- " test_demo_ad_email_phone_captured_in_doorhanger_and_stored.py" ,
8
- " test_demo_ad_name_org_captured_in_doorhanger_and_stored.py" ,
9
- " test_demo_ad_address_data_captured_in_doorhanger_and_stored.py" ,
10
- " test_demo_cc_dropdown-presence.py" ,
11
- " test_demo_cc_clear_form.py"
12
4
]
13
5
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"region" : " DE" ,
3
3
"tests" : [
4
- " test_demo_cc_doorhanger_shown_on_valid_credit_card_submission.py" ,
5
- " test_demo_cc_add_new_credit_card.py" ,
6
- " test_demo_ad_doorhanger_shown_on_valid_address_submission.py" ,
7
- " test_demo_ad_email_phone_captured_in_doorhanger_and_stored.py" ,
8
- " test_demo_ad_name_org_captured_in_doorhanger_and_stored.py" ,
9
- " test_demo_cc_dropdown-presence.py" ,
10
- " test_demo_ad_address_data_captured_in_doorhanger_and_stored.py" ,
11
- " test_demo_cc_clear_form.py"
12
4
]
13
5
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"region" : " FR" ,
3
3
"tests" : [
4
- " test_demo_cc_doorhanger_shown_on_valid_credit_card_submission.py" ,
5
- " test_demo_cc_add_new_credit_card.py" ,
6
- " test_demo_ad_doorhanger_shown_on_valid_address_submission.py" ,
7
- " test_demo_ad_name_org_captured_in_doorhanger_and_stored.py" ,
8
- " test_demo_cc_dropdown-presence.py" ,
9
- " test_demo_ad_email_phone_captured_in_doorhanger_and_stored.py" ,
10
- " test_demo_cc_dropdown-presence.py" ,
11
- " test_demo_cc_clear_form.py"
12
4
]
13
5
}
Original file line number Diff line number Diff line change 1
1
{
2
- "region" : " US" ,
3
- "tests" : [
4
- " test_demo_cc_doorhanger_shown_on_valid_credit_card_submission.py" ,
5
- " test_demo_cc_add_new_credit_card.py" ,
6
- " test_demo_ad_doorhanger_shown_on_valid_address_submission.py" ,
7
- " test_demo_ad_name_org_captured_in_doorhanger_and_stored.py" ,
8
- " test_demo_cc_dropdown-presence.py" ,
9
- " test_demo_ad_address_data_captured_in_doorhanger_and_stored.py" ,
10
- " test_us_demo_addy_verify_new_address_added.py"
11
- ]
12
- }
2
+ "region" : " US" ,
3
+ "tests" : []
4
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "tests" : [
3
+ " test_demo_ad_address_data_captured_in_doorhanger_and_stored.py" ,
4
+ " test_demo_ad_doorhanger_shown_on_valid_address_submission.py" ,
5
+ " test_demo_ad_email_phone_captured_in_doorhanger_and_stored.py" ,
6
+ " test_demo_ad_name_org_captured_in_doorhanger_and_stored.py" ,
7
+ " test_demo_cc_add_new_credit_card.py" ,
8
+ " test_demo_cc_clear_form.py" ,
9
+ " test_demo_cc_doorhanger_shown_on_valid_credit_card_submission.py" ,
10
+ " test_demo_cc_dropdown-presence.py" ,
11
+ " test_us_demo_addy_verify_new_address_added.py"
12
+ ]
13
+ }
Original file line number Diff line number Diff line change @@ -21,14 +21,21 @@ def get_region_tests(test_region: str) -> list[str]:
21
21
22
22
if __name__ == "__main__" :
23
23
valid_region = {"US" , "CA" , "DE" , "FR" }
24
- regions = sys .argv [1 :] if len (sys .argv [1 :]) > 0 else valid_region
24
+ if len (sys .argv [1 :]) == 0 :
25
+ regions = ["Unified" ] + list (valid_region )
26
+ else :
27
+ regions = sys .argv [1 :]
25
28
for region in regions :
26
- if region not in valid_region :
29
+ if region not in valid_region and region != "Unified" :
27
30
raise ValueError ("Invalid Region." )
28
31
tests = get_region_tests (region )
29
32
try :
30
- os .environ ["STARFOX_REGION" ] = region
31
- subprocess .run (["pytest" , * tests ], check = True , text = True )
33
+ if len (tests ) > 0 :
34
+ if region != "Unified" :
35
+ os .environ ["STARFOX_REGION" ] = region
36
+ subprocess .run (["pytest" , * tests ], check = True , text = True )
37
+ else :
38
+ logging .info (f"{ region } has no tests." )
39
+ print (f"{ region } has no tests." )
32
40
except subprocess .CalledProcessError as e :
33
- print (e )
34
41
logging .warn (f"Test run failed. { e } " )
You can’t perform that action at this time.
0 commit comments