diff --git a/tests/audit_math_tests/__init__.py b/tests/audit_math_tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/routes_tests/__init__.py b/tests/routes_tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/routes_tests/test_audit_boards.py b/tests/routes_tests/test_audit_boards.py index 7736d576d..3faf9b6bb 100644 --- a/tests/routes_tests/test_audit_boards.py +++ b/tests/routes_tests/test_audit_boards.py @@ -1,6 +1,6 @@ import pytest, json from flask.testing import FlaskClient -from typing import List +from typing import List, Generator from datetime import datetime from collections import defaultdict @@ -74,7 +74,7 @@ def round_id( contest_id: str, # pylint: disable=unused-argument election_settings, # pylint: disable=unused-argument manifests, # pylint: disable=unused-argument -) -> str: +) -> Generator[str, None, None]: rv = post_json( client, f"/election/{election_id}/round", @@ -89,7 +89,7 @@ def round_id( @pytest.fixture def round_2_id( client: FlaskClient, election_id: str, contest_id: str, round_id: str, -) -> str: +) -> Generator[str, None, None]: # Fake that the first round got completed by setting Round.ended_at. # We also need to add RoundContestResults so that the next round sample # size can get computed. diff --git a/tests/routes_tests/test_audit_status.py b/tests/routes_tests/test_audit_status.py index 51bb9cd4e..f919386e8 100644 --- a/tests/routes_tests/test_audit_status.py +++ b/tests/routes_tests/test_audit_status.py @@ -1,6 +1,7 @@ import json import pytest from flask.testing import FlaskClient +from typing import Generator from tests.helpers import ( compare_json, @@ -14,7 +15,7 @@ @pytest.fixture() -def election_id(client: FlaskClient) -> str: +def election_id(client: FlaskClient) -> Generator[str, None, None]: yield create_election(client, is_multi_jurisdiction=False) diff --git a/tests/routes_tests/test_auth.py b/tests/routes_tests/test_auth.py index 117a3d793..090eb64b3 100644 --- a/tests/routes_tests/test_auth.py +++ b/tests/routes_tests/test_auth.py @@ -130,7 +130,7 @@ def test_auditadmin_callback( rv = client.get("/auth/auditadmin/callback?code=foobar") assert rv.status_code == 302 - with client.session_transaction() as session: + with client.session_transaction() as session: # type: ignore assert session["_user"]["type"] == UserType.AUDIT_ADMIN assert session["_user"]["email"] == AA_EMAIL @@ -155,7 +155,7 @@ def test_jurisdictionadmin_callback( rv = client.get("/auth/jurisdictionadmin/callback?code=foobar") assert rv.status_code == 302 - with client.session_transaction() as session: + with client.session_transaction() as session: # type: ignore assert session["_user"]["type"] == UserType.JURISDICTION_ADMIN assert session["_user"]["email"] == JA_EMAIL @@ -168,7 +168,7 @@ def test_logout(client: FlaskClient): rv = client.get("/auth/logout") - with client.session_transaction() as session: + with client.session_transaction() as session: # type: ignore assert session["_user"] is None assert rv.status_code == 302 diff --git a/tests/routes_tests/test_ballot_list.py b/tests/routes_tests/test_ballot_list.py index bc46a2809..46a4e84ec 100644 --- a/tests/routes_tests/test_ballot_list.py +++ b/tests/routes_tests/test_ballot_list.py @@ -1,6 +1,6 @@ import json from flask.testing import FlaskClient - +from typing import Generator import pytest from tests.helpers import assert_ok, post_json, create_election @@ -9,7 +9,7 @@ @pytest.fixture() -def election_id(client: FlaskClient) -> str: +def election_id(client: FlaskClient) -> Generator[str, None, None]: yield create_election(client, is_multi_jurisdiction=False) diff --git a/tests/routes_tests/test_contests.py b/tests/routes_tests/test_contests.py index 277041ff3..107432be8 100644 --- a/tests/routes_tests/test_contests.py +++ b/tests/routes_tests/test_contests.py @@ -183,7 +183,7 @@ def test_contests_round_status( def test_contests_missing_field( client: FlaskClient, election_id: str, jurisdiction_ids: List[str] ): - contest = { + contest: JSONDict = { "id": str(uuid.uuid4()), "name": "Contest 1", "isTargeted": True, diff --git a/tests/routes_tests/test_report.py b/tests/routes_tests/test_report.py index 076fabbc5..b3c140d50 100644 --- a/tests/routes_tests/test_report.py +++ b/tests/routes_tests/test_report.py @@ -1,6 +1,6 @@ import json, random from flask.testing import FlaskClient - +from typing import Generator import pytest from tests.helpers import assert_ok, post_json, create_election @@ -9,7 +9,7 @@ @pytest.fixture() -def election_id(client: FlaskClient) -> str: +def election_id(client: FlaskClient) -> Generator[str, None, None]: yield create_election(client, is_multi_jurisdiction=False) diff --git a/tests/util_tests/__init__.py b/tests/util_tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/util_tests/test_binpacking.py b/tests/util_tests/test_binpacking.py index db9c3a3dc..d19cc6783 100644 --- a/tests/util_tests/test_binpacking.py +++ b/tests/util_tests/test_binpacking.py @@ -72,7 +72,7 @@ def test_init(self, bucket): ) assert ( not bucket.largest_element - ), "Initial largest element was not None".format(bucket.largest_element) + ), "Initial largest element was not None: {}".format(bucket.largest_element) def test_add_batch(self, bucket): expected_batches = {"1": 100}