Skip to content

Commit

Permalink
Add __init__ files to test packages
Browse files Browse the repository at this point in the history
This ensures that mypy will typecheck them. mypy doesn't recursively
check directories without an __init__ file. See: python/mypy#6385
  • Loading branch information
jonahkagan committed Apr 7, 2020
1 parent 5956ea8 commit d93af14
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 11 deletions.
Empty file.
Empty file added tests/routes_tests/__init__.py
Empty file.
3 changes: 2 additions & 1 deletion tests/routes_tests/test_audit_status.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import pytest
from flask.testing import FlaskClient
from typing import Generator

from tests.helpers import (
compare_json,
Expand All @@ -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)


Expand Down
6 changes: 3 additions & 3 deletions tests/routes_tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/routes_tests/test_ballot_list.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)


Expand Down
2 changes: 1 addition & 1 deletion tests/routes_tests/test_contests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tests/routes_tests/test_jurisdictions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import json, io, uuid
from datetime import datetime
from typing import List
from typing import List, Generator

from tests.helpers import (
assert_ok,
Expand Down
4 changes: 2 additions & 2 deletions tests/routes_tests/test_report.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)


Expand Down
Empty file added tests/util_tests/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion tests/util_tests/test_binpacking.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit d93af14

Please sign in to comment.