2019-05-16 16:34:38 +03:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
2023-03-14 19:54:15 +03:00
|
|
|
from logging import INFO, basicConfig, getLogger
|
2021-02-01 13:05:41 +03:00
|
|
|
|
2019-05-30 14:25:26 +03:00
|
|
|
from bugbug import model
|
2019-05-16 16:34:38 +03:00
|
|
|
from bugbug.models import MODELS, get_model_class
|
|
|
|
|
2023-03-14 19:54:15 +03:00
|
|
|
basicConfig(level=INFO)
|
|
|
|
logger = getLogger(__name__)
|
|
|
|
|
2019-05-16 16:34:38 +03:00
|
|
|
|
|
|
|
def test_import_all_models():
|
2020-08-27 17:19:02 +03:00
|
|
|
"""Try loading all defined models to ensure that their full qualified
|
2019-05-16 16:34:38 +03:00
|
|
|
names are still good
|
|
|
|
"""
|
|
|
|
|
2020-12-21 17:42:24 +03:00
|
|
|
for model_name in MODELS:
|
2023-03-14 19:54:15 +03:00
|
|
|
logger.info("Try loading model %s", model_name)
|
2019-05-16 16:34:38 +03:00
|
|
|
get_model_class(model_name)
|
2019-05-30 14:25:26 +03:00
|
|
|
|
|
|
|
|
|
|
|
def test_component_is_bugmodel():
|
|
|
|
model_class = get_model_class("component")
|
2019-05-30 19:55:22 +03:00
|
|
|
assert issubclass(model_class, model.BugModel)
|
|
|
|
model_class = get_model_class("regression")
|
|
|
|
assert issubclass(model_class, model.BugModel)
|
2019-05-30 14:25:26 +03:00
|
|
|
|
|
|
|
|
|
|
|
def test_backout_is_commitmodel():
|
|
|
|
model_class = get_model_class("backout")
|
2019-05-30 19:55:22 +03:00
|
|
|
assert issubclass(model_class, model.CommitModel)
|