diff --git a/kallithea/__init__.py b/kallithea/__init__.py --- a/kallithea/__init__.py +++ b/kallithea/__init__.py @@ -44,6 +44,7 @@ BACKENDS = { CELERY_APP = celery.Celery() # needed at import time but is lazy and can be configured later +DEFAULT_USER_ID: int # set by setup_configuration CONFIG = {} # set to tg.config when TG app is initialized and calls app_cfg # URL prefix for non repository related links - must start with `/` diff --git a/kallithea/lib/vcs/backends/base.py b/kallithea/lib/vcs/backends/base.py --- a/kallithea/lib/vcs/backends/base.py +++ b/kallithea/lib/vcs/backends/base.py @@ -11,6 +11,7 @@ import datetime import itertools +from typing import Sequence from kallithea.lib.vcs.backends import get_backend from kallithea.lib.vcs.conf import settings @@ -51,8 +52,12 @@ class BaseRepository(object): ``tags`` tags as list of changesets """ - scm = None - DEFAULT_BRANCH_NAME = None + DEFAULT_BRANCH_NAME: str # assigned in subclass + scm: str # assigned in subclass + path: str # assigned in subclass __init__ + revisions: Sequence[str] # LazyProperty in subclass + _empty: bool # property in subclass + EMPTY_CHANGESET = '0' * 40 def __init__(self, repo_path, create=False, **kwargs): @@ -367,6 +372,9 @@ class BaseChangeset(object): otherwise; trying to access this attribute while there is no changesets would raise ``EmptyRepositoryError`` """ + message: str # LazyProperty in subclass + date: datetime.datetime # LazyProperty in subclass + def __str__(self): return '<%s at %s:%s>' % (self.__class__.__name__, self.revision, self.short_id) diff --git a/kallithea/tests/api/api_base.py b/kallithea/tests/api/api_base.py --- a/kallithea/tests/api/api_base.py +++ b/kallithea/tests/api/api_base.py @@ -20,9 +20,11 @@ import os import random import re import string +from typing import Sized import mock import pytest +from webtest import TestApp from kallithea.lib import ext_json from kallithea.lib.auth import AuthUser @@ -86,8 +88,14 @@ def make_repo_group(name=TEST_REPO_GROUP class _BaseTestApi(object): - REPO = None - REPO_TYPE = None + app: TestApp # assigned by app_fixture in subclass TestController mixin + # assigned in subclass: + REPO: str + REPO_TYPE: str + TEST_REVISION: str + TEST_PR_SRC: str + TEST_PR_DST: str + TEST_PR_REVISIONS: Sized @classmethod def setup_class(cls): diff --git a/kallithea/tests/base.py b/kallithea/tests/base.py --- a/kallithea/tests/base.py +++ b/kallithea/tests/base.py @@ -138,6 +138,8 @@ class NullHandler(logging.Handler): class TestController(object): """Pytest-style test controller""" + app: TestApp # assigned by app_fixture + _logged_username: str # assigned by log_user # Note: pytest base classes cannot have an __init__ method diff --git a/scripts/deps.py b/scripts/deps.py --- a/scripts/deps.py +++ b/scripts/deps.py @@ -93,6 +93,7 @@ time traceback traitlets types +typing urllib urlobject uuid