Skip to content

Commit a2e3355

Browse files
moved other tests to unified.json and reworked runner script
1 parent 8f4be04 commit a2e3355

File tree

7 files changed

+36
-47
lines changed

7 files changed

+36
-47
lines changed

l10n_CM/Unified/conftest.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
from typing import List
23

34
import pytest
45

@@ -15,18 +16,18 @@ def region():
1516

1617
@pytest.fixture()
1718
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 = [
1926
("extensions.formautofill.creditCards.reauth.optout", False),
2027
("extensions.formautofill.reauth.enabled", False),
2128
("browser.aboutConfig.showWarning", False),
2229
("browser.search.region", region),
2330
]
24-
25-
26-
@pytest.fixture()
27-
def set_prefs(add_prefs: dict, region: str):
28-
"""Set prefs"""
29-
prefs = []
3031
prefs.extend(add_prefs)
3132
return prefs
3233

l10n_CM/region/CA.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
{
22
"region": "CA",
33
"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"
124
]
135
}

l10n_CM/region/DE.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
{
22
"region": "DE",
33
"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"
124
]
135
}

l10n_CM/region/FR.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
{
22
"region": "FR",
33
"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"
124
]
135
}

l10n_CM/region/US.json

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
{
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+
}

l10n_CM/region/Unified.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
}

l10n_CM/run_l10n.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,21 @@ def get_region_tests(test_region: str) -> list[str]:
2121

2222
if __name__ == "__main__":
2323
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:]
2528
for region in regions:
26-
if region not in valid_region:
29+
if region not in valid_region and region != "Unified":
2730
raise ValueError("Invalid Region.")
2831
tests = get_region_tests(region)
2932
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.")
3240
except subprocess.CalledProcessError as e:
33-
print(e)
3441
logging.warn(f"Test run failed. {e}")

0 commit comments

Comments
 (0)