Skip to content
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
11 changes: 6 additions & 5 deletions lnt/server/db/fieldchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from sqlalchemy.orm.session import Session
from sqlalchemy.orm.exc import ObjectDeletedError
from typing import Tuple, List
import typing

import lnt.server.reporting.analysis
from lnt.testing.util.commands import timed
Expand All @@ -27,7 +28,7 @@ def post_submit_tasks(session, ts, run_id):
regenerate_fieldchanges_for_run(session, ts, run_id)


def delete_fieldchange(session: Session, ts: TestSuiteDB, change: TestSuiteDB.FieldChange) -> List[int]:
def delete_fieldchange(session: Session, ts: TestSuiteDB, change) -> List[int]:
"""Delete this field change. Since it might be attahed to a regression
via regression indicators, fix those up too. If this orphans a regression
delete it as well."""
Expand All @@ -36,7 +37,7 @@ def delete_fieldchange(session: Session, ts: TestSuiteDB, change: TestSuiteDB.Fi
filter(ts.RegressionIndicator.field_change_id == change.id). \
all()
# And all the related regressions.
regression_ids = [r.regression_id for r in indicators]
regression_ids: List[int] = [r.regression_id for r in indicators]

# Remove the idicators that point to this change.
for ind in indicators:
Expand All @@ -47,13 +48,13 @@ def delete_fieldchange(session: Session, ts: TestSuiteDB, change: TestSuiteDB.Fi

# We might have just created a regression with no changes.
# If so, delete it as well.
deleted_ids = []
deleted_ids: List[int] = []
for r in regression_ids:
remaining = session.query(ts.RegressionIndicator). \
filter(ts.RegressionIndicator.regression_id == r). \
all()
if len(remaining) == 0:
r = session.query(ts.Regression).get(r)
r = typing.cast(int, session.query(ts.Regression).get(r))
logger.info("Deleting regression because it has not changes:" +
repr(r))
session.delete(r)
Expand Down Expand Up @@ -224,7 +225,7 @@ def percent_similar(a: str, b: str) -> float:
@timed
def identify_related_changes(session: Session,
ts: TestSuiteDB,
fc: TestSuiteDB.FieldChange,
fc, # TestSuiteDB.FieldChange
active_changes: List) -> Tuple[bool, List]:
"""Can we find a home for this change in some existing regression? If a
match is found add a regression indicator adding this change to that
Expand Down
2 changes: 1 addition & 1 deletion lnt/server/db/rules/rule_update_fixed_regressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def is_fixed(session, ts, regression):
return all(fixes)


def impacts(session: Session, ts: TestSuiteDB, run_id: int, regression: TestSuiteDB.Regression) -> bool:
def impacts(session: Session, ts: TestSuiteDB, run_id: int, regression) -> bool:
"""Does this run have a chance of impacting this regression?

This is just to prevent doing a full comparison, so we don't have
Expand Down
7 changes: 4 additions & 3 deletions lnt/server/ui/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import re
import time
import typing # noqa: F401
from collections import namedtuple, defaultdict
from urllib.parse import urlparse, urljoin
from io import BytesIO
Expand All @@ -20,7 +21,6 @@
from flask_wtf import Form
from sqlalchemy.orm import joinedload
from sqlalchemy.orm.exc import NoResultFound
from typing import Optional
from wtforms import SelectField, StringField, SubmitField
from wtforms.validators import DataRequired, Length

Expand All @@ -36,7 +36,7 @@
import lnt.util.ImportData
import lnt.util.stats
from lnt.external.stats import stats as ext_stats
from lnt.server.db import testsuitedb
from lnt.server.db import testsuitedb # noqa: F401
from lnt.server.reporting.analysis import ComparisonResult, calc_geomean
from lnt.server.ui import util
from lnt.server.ui.decorators import frontend, db_route, v4_route
Expand Down Expand Up @@ -1844,7 +1844,8 @@ class MatrixOptions(Form):
limit = SelectField('Size', choices=MATRIX_LIMITS)


def baseline() -> Optional[testsuitedb.TestSuiteDB.Baseline]:
def baseline():
# type: () -> typing.Optional[testsuitedb.TestSuiteDB.Baseline]
"""Get the baseline object from the user's current session baseline value
or None if one is not defined.
"""
Expand Down
7 changes: 3 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ deps =
types-certifi

commands =
# Nowhere close to passing yet, but nice to have. The option
# --no-incremental is currently needed to suppress warnings about
# UpdatedBase when running tests several times. Future versions of
# The option --no-incremental is currently needed to suppress warnings
# about UpdatedBase when running tests several times. Future versions of
# mypy should be checked to see if it can be removed and not get
# warnings after running tox several times.
- mypy --no-incremental --junit-xml=junit-{envname}.xml --ignore-missing-imports lnt
mypy --no-incremental --junit-xml=junit-{envname}.xml --ignore-missing-imports lnt

[testenv:flake8]
skip_install = true
Expand Down
Loading