Skip to content

Commit

Permalink
Update poetry, locust and rapidfuzz
Browse files Browse the repository at this point in the history
  • Loading branch information
erikh360 committed Feb 22, 2024
1 parent 29f3088 commit 40cd018
Show file tree
Hide file tree
Showing 8 changed files with 316 additions and 232 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
python-version: 3.9.15
- uses: abatilo/[email protected]
with:
poetry-version: 1.4.2
poetry-version: 1.7.1
- name: Install dependancies
run: |
poetry install
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM ghcr.io/praekeltfoundation/python-base-nw:3.9-bullseye as build

# Requirements to build wheels where there are no python 3.9 wheels
RUN apt-get-install.sh gcc libc-dev make
RUN pip install "poetry==1.4.2"
RUN pip install "poetry==1.7.1"
RUN poetry config virtualenvs.in-project true

# Install just the deps so we use cached layers if they haven't changed
Expand Down
469 changes: 272 additions & 197 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sentry-sdk = "^1.5.2"
phonenumberslite = "^8.13.9"
pycountry = "^20.7.3"
aiohttp-client-cache = "^0.5.2"
rapidfuzz = ">=1.4.1,<1.6.0" # 1.6.0 changes search result ordering
rapidfuzz = "3.6.1"
holidays = "^0.11.2"
email-validator = "^1.1.3"
zbar-py = "^1.0.4"
Expand All @@ -45,7 +45,7 @@ pytest = "^7.2.0"
pytest-cov = "^4.0.0"
pytest-asyncio = "^0.14.0"
Faker = "^8.1.0"
locust = "^1.4.4"
locust = "2.23.1"
sanic-testing = "^0.8.3"
mypy = "^0.960"
types-redis = "^4.2.6"
Expand Down
2 changes: 1 addition & 1 deletion vaccine/data/suburbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def _search(self, province_id, search_text, municipality_id=None, m_limit=3):
else:
suburbs_search = {k: f"{v.name}, {v.city}" for k, v in suburbs.items()}
possibilities = process.extract(
search_text, suburbs_search, score_cutoff=80, limit=100
search_text, suburbs_search, score_cutoff=70, limit=100
)

if municipality_id is None and len(possibilities) > m_limit:
Expand Down
5 changes: 3 additions & 2 deletions vaccine/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ def test_invalid(self):

class CountriesTests(TestCase):
def test_search_united_states(self):
assert Countries().search_for_country("united states")[0][0] == "UM"
assert Countries().search_for_country("united states")[1][0] == "US"
assert Countries().search_for_country("united states")[0][0] == "VI"
assert Countries().search_for_country("united states")[1][0] == "UM"
assert Countries().search_for_country("united states")[2][0] == "US"

def test_search_ireland(self):
assert Countries().search_for_country("ireland")[0][0] == "IE"
Expand Down
24 changes: 13 additions & 11 deletions vaccine/tests/test_vaccine_reg_ussd.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ async def test_passport_country_search():
[
"Please choose the best match for your COUNTRY of origin:",
"1. Republic of Côte d'Ivoire",
"2. British Indian Ocean Territ",
"3. Plurinational State of Boli",
"2. Mayotte",
"3. Republic of the Congo",
"4. Other",
]
)
Expand Down Expand Up @@ -924,13 +924,15 @@ async def test_municipality(evds_mock):
assert reply.content == "\n".join(
[
"Please select your municipality",
"1. Buffalo City",
"2. Enoch Mgijima",
"3. Great Kei",
"4. King Sabata Dalindyebo",
"5. Nelson Mandela Bay",
"6. Raymond Mhlaba",
"7. Other",
"1. Great Kei",
"2. King Sabata Dalindyebo",
"3. Matatiele",
"4. Mbhashe",
"5. Mbizana",
"6. Amahlathi",
"7. Buffalo City",
"8. Engcobo",
"9. Other",
]
)
assert u.state.name == "state_municipality"
Expand All @@ -946,7 +948,7 @@ async def test_suburb_with_municipality(evds_mock):
)
app = Application(u)
msg = Message(
content="Raymond Mhlaba",
content="Matatiele",
to_addr="27820001002",
from_addr="27820001001",
transport_name="whatsapp",
Expand All @@ -957,7 +959,7 @@ async def test_suburb_with_municipality(evds_mock):
assert reply.content == "\n".join(
[
"Please choose the best match for your location:",
"1. Mandela Park, Balfour",
"1. Matandela, Matandela",
"2. Other",
]
)
Expand Down
40 changes: 23 additions & 17 deletions vaccine/tests/test_vaccine_reg_whatsapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ async def test_passport_country_search(tester: AppTester):
"",
"REPLY with a NUMBER from the list below:",
"1. Republic of Côte d'Ivoire",
"2. British Indian Ocean Territory",
"3. Plurinational State of Bolivia",
"2. Mayotte",
"3. Republic of the Congo",
"4. Other",
]
)
Expand Down Expand Up @@ -603,16 +603,22 @@ async def test_municipality(evds_mock, tester: AppTester):
"",
"Please confirm the MUNICIPALITY for the suburb you have given:",
"",
"1. Buffalo City",
"2. Enoch Mgijima",
"3. Great Kei",
"4. King Sabata Dalindyebo",
"5. Nelson Mandela Bay",
"6. Raymond Mhlaba",
"7. Umzimvubu",
"8. Mbizana",
"9. Mnquma",
"10. Other",
"1. Great Kei",
"2. King Sabata Dalindyebo",
"3. Matatiele",
"4. Mbhashe",
"5. Mbizana",
"6. Amahlathi",
"7. Buffalo City",
"8. Engcobo",
"9. Enoch Mgijima",
"10. Nelson Mandela Bay",
"11. Ngquza Hill",
"12. Raymond Mhlaba",
"13. Umzimvubu",
"14. Mhlontlo",
"15. Nyandeni",
"16. Other",
]
)
)
Expand Down Expand Up @@ -784,8 +790,8 @@ async def test_medical_aid_list_1(evds_mock, tester: AppTester):
"the list below:",
"",
"1. Discovery Health Medical Scheme",
"2. Aeci Medical Aid Society",
"3. BMW Employees Medical Aid Society",
"2. Government Employees Medical Scheme (GEMS)",
"3. Rhodes University Medical Scheme",
"4. None of these",
]
)
Expand All @@ -806,8 +812,8 @@ async def test_medical_aid_list_2(evds_mock, tester: AppTester):
"the list below:",
"",
"1. Tsogo Sun Group Medical Scheme",
"2. Golden Arrows Employees Medical Benefit Fund",
"3. Engen Medical Benefit Fund",
"2. Engen Medical Benefit Fund",
"3. Food Workers Medical Benefit Fund",
"4. None of these",
]
)
Expand All @@ -829,7 +835,7 @@ async def test_medical_aid_list_3(evds_mock, tester: AppTester):
"",
"1. De Beers Benefit Society",
"2. BMW Employees Medical Aid Society",
"3. Government Employees Medical Scheme (GEMS)",
"3. Golden Arrows Employees Medical Benefit Fund",
"4. None of these",
]
)
Expand Down

0 comments on commit 40cd018

Please sign in to comment.