Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add __init__ files to test packages #418

Merged
merged 1 commit into from
Apr 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
Empty file added tests/routes_tests/__init__.py
Empty file.
6 changes: 3 additions & 3 deletions tests/routes_tests/test_audit_boards.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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",
Expand All @@ -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.
Expand Down
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
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