mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
chore: rename logging.py and redis.py to avoid circular imports
Signed-off-by: Leonidas Spyropoulos <artafinde@archlinux.org>
This commit is contained in:
parent
b757e66997
commit
9c0f8f053e
32 changed files with 72 additions and 73 deletions
|
@ -22,19 +22,18 @@ from starlette.middleware.sessions import SessionMiddleware
|
||||||
import aurweb.captcha # noqa: F401
|
import aurweb.captcha # noqa: F401
|
||||||
import aurweb.config
|
import aurweb.config
|
||||||
import aurweb.filters # noqa: F401
|
import aurweb.filters # noqa: F401
|
||||||
import aurweb.logging
|
|
||||||
import aurweb.pkgbase.util as pkgbaseutil
|
import aurweb.pkgbase.util as pkgbaseutil
|
||||||
from aurweb import logging, prometheus, util
|
from aurweb import aur_logging, prometheus, util
|
||||||
|
from aurweb.aur_redis import redis_connection
|
||||||
from aurweb.auth import BasicAuthBackend
|
from aurweb.auth import BasicAuthBackend
|
||||||
from aurweb.db import get_engine, query
|
from aurweb.db import get_engine, query
|
||||||
from aurweb.models import AcceptedTerm, Term
|
from aurweb.models import AcceptedTerm, Term
|
||||||
from aurweb.packages.util import get_pkg_or_base
|
from aurweb.packages.util import get_pkg_or_base
|
||||||
from aurweb.prometheus import instrumentator
|
from aurweb.prometheus import instrumentator
|
||||||
from aurweb.redis import redis_connection
|
|
||||||
from aurweb.routers import APP_ROUTES
|
from aurweb.routers import APP_ROUTES
|
||||||
from aurweb.templates import make_context, render_template
|
from aurweb.templates import make_context, render_template
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
|
|
||||||
# Setup the FastAPI app.
|
# Setup the FastAPI app.
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
|
@ -2,9 +2,9 @@ import fakeredis
|
||||||
from redis import ConnectionPool, Redis
|
from redis import ConnectionPool, Redis
|
||||||
|
|
||||||
import aurweb.config
|
import aurweb.config
|
||||||
from aurweb import logging
|
from aurweb import aur_logging
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
pool = None
|
pool = None
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@ import argparse
|
||||||
import alembic.command
|
import alembic.command
|
||||||
import alembic.config
|
import alembic.config
|
||||||
|
|
||||||
|
import aurweb.aur_logging
|
||||||
import aurweb.db
|
import aurweb.db
|
||||||
import aurweb.logging
|
|
||||||
import aurweb.schema
|
import aurweb.schema
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,12 +10,12 @@ from sqlalchemy.orm import backref, relationship
|
||||||
import aurweb.config
|
import aurweb.config
|
||||||
import aurweb.models.account_type
|
import aurweb.models.account_type
|
||||||
import aurweb.schema
|
import aurweb.schema
|
||||||
from aurweb import db, logging, schema, time, util
|
from aurweb import aur_logging, db, schema, time, util
|
||||||
from aurweb.models.account_type import AccountType as _AccountType
|
from aurweb.models.account_type import AccountType as _AccountType
|
||||||
from aurweb.models.ban import is_banned
|
from aurweb.models.ban import is_banned
|
||||||
from aurweb.models.declarative import Base
|
from aurweb.models.declarative import Base
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
|
|
||||||
SALT_ROUNDS_DEFAULT = 12
|
SALT_ROUNDS_DEFAULT = 12
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,11 @@ from fastapi import HTTPException
|
||||||
from sqlalchemy import orm
|
from sqlalchemy import orm
|
||||||
|
|
||||||
from aurweb import config, db, models
|
from aurweb import config, db, models
|
||||||
|
from aurweb.aur_redis import redis_connection
|
||||||
from aurweb.models import Package
|
from aurweb.models import Package
|
||||||
from aurweb.models.official_provider import OFFICIAL_BASE, OfficialProvider
|
from aurweb.models.official_provider import OFFICIAL_BASE, OfficialProvider
|
||||||
from aurweb.models.package_dependency import PackageDependency
|
from aurweb.models.package_dependency import PackageDependency
|
||||||
from aurweb.models.package_relation import PackageRelation
|
from aurweb.models.package_relation import PackageRelation
|
||||||
from aurweb.redis import redis_connection
|
|
||||||
from aurweb.templates import register_filter
|
from aurweb.templates import register_filter
|
||||||
|
|
||||||
Providers = list[Union[PackageRelation, OfficialProvider]]
|
Providers = list[Union[PackageRelation, OfficialProvider]]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from fastapi import Request
|
from fastapi import Request
|
||||||
|
|
||||||
from aurweb import db, logging, util
|
from aurweb import aur_logging, db, util
|
||||||
from aurweb.auth import creds
|
from aurweb.auth import creds
|
||||||
from aurweb.models import PackageBase, User
|
from aurweb.models import PackageBase, User
|
||||||
from aurweb.models.package_comaintainer import PackageComaintainer
|
from aurweb.models.package_comaintainer import PackageComaintainer
|
||||||
|
@ -10,7 +10,7 @@ from aurweb.packages.requests import handle_request, update_closure_comment
|
||||||
from aurweb.pkgbase import util as pkgbaseutil
|
from aurweb.pkgbase import util as pkgbaseutil
|
||||||
from aurweb.scripts import notify, popupdate
|
from aurweb.scripts import notify, popupdate
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@db.retry_deadlock
|
@db.retry_deadlock
|
||||||
|
|
|
@ -5,9 +5,9 @@ from prometheus_fastapi_instrumentator import Instrumentator
|
||||||
from prometheus_fastapi_instrumentator.metrics import Info
|
from prometheus_fastapi_instrumentator.metrics import Info
|
||||||
from starlette.routing import Match, Route
|
from starlette.routing import Match, Route
|
||||||
|
|
||||||
from aurweb import logging
|
from aurweb import aur_logging
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
_instrumentator = Instrumentator()
|
_instrumentator = Instrumentator()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
from fastapi import Request
|
from fastapi import Request
|
||||||
from redis.client import Pipeline
|
from redis.client import Pipeline
|
||||||
|
|
||||||
from aurweb import config, db, logging, time
|
from aurweb import aur_logging, config, db, time
|
||||||
|
from aurweb.aur_redis import redis_connection
|
||||||
from aurweb.models import ApiRateLimit
|
from aurweb.models import ApiRateLimit
|
||||||
from aurweb.redis import redis_connection
|
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def _update_ratelimit_redis(request: Request, pipeline: Pipeline):
|
def _update_ratelimit_redis(request: Request, pipeline: Pipeline):
|
||||||
|
|
|
@ -8,7 +8,7 @@ from fastapi.responses import HTMLResponse, RedirectResponse
|
||||||
from sqlalchemy import and_, or_
|
from sqlalchemy import and_, or_
|
||||||
|
|
||||||
import aurweb.config
|
import aurweb.config
|
||||||
from aurweb import cookies, db, l10n, logging, models, util
|
from aurweb import aur_logging, cookies, db, l10n, models, util
|
||||||
from aurweb.auth import account_type_required, creds, requires_auth, requires_guest
|
from aurweb.auth import account_type_required, creds, requires_auth, requires_guest
|
||||||
from aurweb.captcha import get_captcha_salts
|
from aurweb.captcha import get_captcha_salts
|
||||||
from aurweb.exceptions import ValidationError, handle_form_exceptions
|
from aurweb.exceptions import ValidationError, handle_form_exceptions
|
||||||
|
@ -22,7 +22,7 @@ from aurweb.users import update, validate
|
||||||
from aurweb.users.util import get_user_by_name
|
from aurweb.users.util import get_user_by_name
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@router.get("/passreset", response_class=HTMLResponse)
|
@router.get("/passreset", response_class=HTMLResponse)
|
||||||
|
|
|
@ -16,7 +16,7 @@ from sqlalchemy import and_, case, or_
|
||||||
|
|
||||||
import aurweb.config
|
import aurweb.config
|
||||||
import aurweb.models.package_request
|
import aurweb.models.package_request
|
||||||
from aurweb import cookies, db, logging, models, time, util
|
from aurweb import aur_logging, cookies, db, models, time, util
|
||||||
from aurweb.cache import db_count_cache
|
from aurweb.cache import db_count_cache
|
||||||
from aurweb.exceptions import handle_form_exceptions
|
from aurweb.exceptions import handle_form_exceptions
|
||||||
from aurweb.models.account_type import TRUSTED_USER_AND_DEV_ID, TRUSTED_USER_ID
|
from aurweb.models.account_type import TRUSTED_USER_AND_DEV_ID, TRUSTED_USER_ID
|
||||||
|
@ -24,7 +24,7 @@ from aurweb.models.package_request import PENDING_ID
|
||||||
from aurweb.packages.util import query_notified, query_voted, updated_packages
|
from aurweb.packages.util import query_notified, query_voted, updated_packages
|
||||||
from aurweb.templates import make_context, render_template
|
from aurweb.templates import make_context, render_template
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ async def index(request: Request):
|
||||||
|
|
||||||
bases = db.query(models.PackageBase)
|
bases = db.query(models.PackageBase)
|
||||||
|
|
||||||
redis = aurweb.redis.redis_connection()
|
redis = aurweb.aur_redis.redis_connection()
|
||||||
cache_expire = 300 # Five minutes.
|
cache_expire = 300 # Five minutes.
|
||||||
|
|
||||||
# Package statistics.
|
# Package statistics.
|
||||||
|
|
|
@ -5,7 +5,7 @@ from typing import Any
|
||||||
from fastapi import APIRouter, Form, Query, Request, Response
|
from fastapi import APIRouter, Form, Query, Request, Response
|
||||||
|
|
||||||
import aurweb.filters # noqa: F401
|
import aurweb.filters # noqa: F401
|
||||||
from aurweb import config, db, defaults, logging, models, util
|
from aurweb import aur_logging, config, db, defaults, models, util
|
||||||
from aurweb.auth import creds, requires_auth
|
from aurweb.auth import creds, requires_auth
|
||||||
from aurweb.exceptions import InvariantError, handle_form_exceptions
|
from aurweb.exceptions import InvariantError, handle_form_exceptions
|
||||||
from aurweb.models.relation_type import CONFLICTS_ID, PROVIDES_ID, REPLACES_ID
|
from aurweb.models.relation_type import CONFLICTS_ID, PROVIDES_ID, REPLACES_ID
|
||||||
|
@ -15,7 +15,7 @@ from aurweb.packages.util import get_pkg_or_base
|
||||||
from aurweb.pkgbase import actions as pkgbase_actions, util as pkgbaseutil
|
from aurweb.pkgbase import actions as pkgbase_actions, util as pkgbaseutil
|
||||||
from aurweb.templates import make_context, make_variable_context, render_template
|
from aurweb.templates import make_context, make_variable_context, render_template
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ from fastapi import APIRouter, Form, HTTPException, Query, Request, Response
|
||||||
from fastapi.responses import JSONResponse, RedirectResponse
|
from fastapi.responses import JSONResponse, RedirectResponse
|
||||||
from sqlalchemy import and_
|
from sqlalchemy import and_
|
||||||
|
|
||||||
from aurweb import config, db, l10n, logging, templates, time, util
|
from aurweb import aur_logging, config, db, l10n, templates, time, util
|
||||||
from aurweb.auth import creds, requires_auth
|
from aurweb.auth import creds, requires_auth
|
||||||
from aurweb.exceptions import InvariantError, ValidationError, handle_form_exceptions
|
from aurweb.exceptions import InvariantError, ValidationError, handle_form_exceptions
|
||||||
from aurweb.models import PackageBase
|
from aurweb.models import PackageBase
|
||||||
|
@ -21,7 +21,7 @@ from aurweb.scripts import notify, popupdate
|
||||||
from aurweb.scripts.rendercomment import update_comment_render_fastapi
|
from aurweb.scripts.rendercomment import update_comment_render_fastapi
|
||||||
from aurweb.templates import make_variable_context, render_template
|
from aurweb.templates import make_variable_context, render_template
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ from fastapi import APIRouter, Form, HTTPException, Request
|
||||||
from fastapi.responses import RedirectResponse, Response
|
from fastapi.responses import RedirectResponse, Response
|
||||||
from sqlalchemy import and_, func, or_
|
from sqlalchemy import and_, func, or_
|
||||||
|
|
||||||
from aurweb import db, l10n, logging, models, time
|
from aurweb import aur_logging, db, l10n, models, time
|
||||||
from aurweb.auth import creds, requires_auth
|
from aurweb.auth import creds, requires_auth
|
||||||
from aurweb.exceptions import handle_form_exceptions
|
from aurweb.exceptions import handle_form_exceptions
|
||||||
from aurweb.models import User
|
from aurweb.models import User
|
||||||
|
@ -15,7 +15,7 @@ from aurweb.models.account_type import TRUSTED_USER_AND_DEV_ID, TRUSTED_USER_ID
|
||||||
from aurweb.templates import make_context, make_variable_context, render_template
|
from aurweb.templates import make_context, make_variable_context, render_template
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
|
|
||||||
# Some TU route specific constants.
|
# Some TU route specific constants.
|
||||||
ITEMS_PER_PAGE = 10 # Paged table size.
|
ITEMS_PER_PAGE = 10 # Paged table size.
|
||||||
|
|
|
@ -32,11 +32,11 @@ import orjson
|
||||||
from sqlalchemy import literal, orm
|
from sqlalchemy import literal, orm
|
||||||
|
|
||||||
import aurweb.config
|
import aurweb.config
|
||||||
from aurweb import db, filters, logging, models, util
|
from aurweb import aur_logging, db, filters, models, util
|
||||||
from aurweb.benchmark import Benchmark
|
from aurweb.benchmark import Benchmark
|
||||||
from aurweb.models import Package, PackageBase, User
|
from aurweb.models import Package, PackageBase, User
|
||||||
|
|
||||||
logger = logging.get_logger("aurweb.scripts.mkpkglists")
|
logger = aur_logging.get_logger("aurweb.scripts.mkpkglists")
|
||||||
|
|
||||||
|
|
||||||
TYPE_MAP = {
|
TYPE_MAP = {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import aurweb.config
|
||||||
import aurweb.db
|
import aurweb.db
|
||||||
import aurweb.filters
|
import aurweb.filters
|
||||||
import aurweb.l10n
|
import aurweb.l10n
|
||||||
from aurweb import db, logging
|
from aurweb import aur_logging, db
|
||||||
from aurweb.models import PackageBase, User
|
from aurweb.models import PackageBase, User
|
||||||
from aurweb.models.package_comaintainer import PackageComaintainer
|
from aurweb.models.package_comaintainer import PackageComaintainer
|
||||||
from aurweb.models.package_comment import PackageComment
|
from aurweb.models.package_comment import PackageComment
|
||||||
|
@ -22,7 +22,7 @@ from aurweb.models.package_request import PackageRequest
|
||||||
from aurweb.models.request_type import RequestType
|
from aurweb.models.request_type import RequestType
|
||||||
from aurweb.models.tu_vote import TUVote
|
from aurweb.models.tu_vote import TUVote
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
|
|
||||||
aur_location = aurweb.config.get("options", "aur_location")
|
aur_location = aurweb.config.get("options", "aur_location")
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,10 @@ import markdown
|
||||||
import pygit2
|
import pygit2
|
||||||
|
|
||||||
import aurweb.config
|
import aurweb.config
|
||||||
from aurweb import db, logging, util
|
from aurweb import aur_logging, db, util
|
||||||
from aurweb.models import PackageComment
|
from aurweb.models import PackageComment
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class LinkifyExtension(markdown.extensions.Extension):
|
class LinkifyExtension(markdown.extensions.Extension):
|
||||||
|
|
|
@ -4,10 +4,10 @@ import re
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from aurweb import logging, util
|
from aurweb import aur_logging, util
|
||||||
from aurweb.templates import base_template
|
from aurweb.templates import base_template
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class AlpmDatabase:
|
class AlpmDatabase:
|
||||||
|
|
|
@ -4,9 +4,9 @@ from typing import Callable
|
||||||
|
|
||||||
from posix_ipc import O_CREAT, Semaphore
|
from posix_ipc import O_CREAT, Semaphore
|
||||||
|
|
||||||
from aurweb import logging
|
from aurweb import aur_logging
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def default_on_create(path):
|
def default_on_create(path):
|
||||||
|
|
|
@ -9,7 +9,7 @@ when encountering invalid criteria and return silently otherwise.
|
||||||
from fastapi import Request
|
from fastapi import Request
|
||||||
from sqlalchemy import and_
|
from sqlalchemy import and_
|
||||||
|
|
||||||
from aurweb import config, db, l10n, logging, models, time, util
|
from aurweb import aur_logging, config, db, l10n, models, time, util
|
||||||
from aurweb.auth import creds
|
from aurweb.auth import creds
|
||||||
from aurweb.captcha import get_captcha_answer, get_captcha_salts, get_captcha_token
|
from aurweb.captcha import get_captcha_answer, get_captcha_salts, get_captcha_token
|
||||||
from aurweb.exceptions import ValidationError
|
from aurweb.exceptions import ValidationError
|
||||||
|
@ -17,7 +17,7 @@ from aurweb.models.account_type import ACCOUNT_TYPE_NAME
|
||||||
from aurweb.models.ssh_pub_key import get_fingerprint
|
from aurweb.models.ssh_pub_key import get_fingerprint
|
||||||
from aurweb.util import strtobool
|
from aurweb.util import strtobool
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def invalid_fields(E: str = str(), U: str = str(), **kwargs) -> None:
|
def invalid_fields(E: str = str(), U: str = str(), **kwargs) -> None:
|
||||||
|
|
|
@ -15,9 +15,9 @@ from email_validator import EmailSyntaxError, validate_email
|
||||||
from fastapi.responses import JSONResponse
|
from fastapi.responses import JSONResponse
|
||||||
|
|
||||||
import aurweb.config
|
import aurweb.config
|
||||||
from aurweb import defaults, logging
|
from aurweb import aur_logging, defaults
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def make_random_string(length: int) -> str:
|
def make_random_string(length: int) -> str:
|
||||||
|
|
|
@ -52,12 +52,12 @@ from sqlalchemy.orm import scoped_session
|
||||||
|
|
||||||
import aurweb.config
|
import aurweb.config
|
||||||
import aurweb.db
|
import aurweb.db
|
||||||
from aurweb import initdb, logging, testing
|
from aurweb import aur_logging, initdb, testing
|
||||||
from aurweb.testing.email import Email
|
from aurweb.testing.email import Email
|
||||||
from aurweb.testing.filelock import FileLock
|
from aurweb.testing.filelock import FileLock
|
||||||
from aurweb.testing.git import GitRepository
|
from aurweb.testing.git import GitRepository
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
|
|
||||||
# Synchronization lock for database setup.
|
# Synchronization lock for database setup.
|
||||||
setup_lock = Lock()
|
setup_lock = Lock()
|
||||||
|
|
|
@ -11,7 +11,7 @@ from fastapi.testclient import TestClient
|
||||||
|
|
||||||
import aurweb.config
|
import aurweb.config
|
||||||
import aurweb.models.account_type as at
|
import aurweb.models.account_type as at
|
||||||
from aurweb import captcha, db, logging, time
|
from aurweb import aur_logging, captcha, db, time
|
||||||
from aurweb.asgi import app
|
from aurweb.asgi import app
|
||||||
from aurweb.db import create, query
|
from aurweb.db import create, query
|
||||||
from aurweb.models.accepted_term import AcceptedTerm
|
from aurweb.models.accepted_term import AcceptedTerm
|
||||||
|
@ -31,7 +31,7 @@ from aurweb.models.user import User
|
||||||
from aurweb.testing.html import get_errors
|
from aurweb.testing.html import get_errors
|
||||||
from aurweb.testing.requests import Request
|
from aurweb.testing.requests import Request
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
|
|
||||||
# Some test global constants.
|
# Some test global constants.
|
||||||
TEST_USERNAME = "test"
|
TEST_USERNAME = "test"
|
||||||
|
|
|
@ -10,17 +10,17 @@ from fastapi import HTTPException
|
||||||
from fastapi.testclient import TestClient
|
from fastapi.testclient import TestClient
|
||||||
|
|
||||||
import aurweb.asgi
|
import aurweb.asgi
|
||||||
|
import aurweb.aur_redis
|
||||||
import aurweb.config
|
import aurweb.config
|
||||||
import aurweb.redis
|
|
||||||
from aurweb.exceptions import handle_form_exceptions
|
from aurweb.exceptions import handle_form_exceptions
|
||||||
from aurweb.testing.requests import Request
|
from aurweb.testing.requests import Request
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def setup(db_test, email_test):
|
def setup(db_test, email_test):
|
||||||
aurweb.redis.redis_connection().flushall()
|
aurweb.aur_redis.redis_connection().flushall()
|
||||||
yield
|
yield
|
||||||
aurweb.redis.redis_connection().flushall()
|
aurweb.aur_redis.redis_connection().flushall()
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
|
@ -7,6 +7,7 @@ from fastapi.testclient import TestClient
|
||||||
|
|
||||||
from aurweb import db, time
|
from aurweb import db, time
|
||||||
from aurweb.asgi import app
|
from aurweb.asgi import app
|
||||||
|
from aurweb.aur_redis import redis_connection
|
||||||
from aurweb.models.account_type import USER_ID
|
from aurweb.models.account_type import USER_ID
|
||||||
from aurweb.models.package import Package
|
from aurweb.models.package import Package
|
||||||
from aurweb.models.package_base import PackageBase
|
from aurweb.models.package_base import PackageBase
|
||||||
|
@ -14,7 +15,6 @@ from aurweb.models.package_comaintainer import PackageComaintainer
|
||||||
from aurweb.models.package_request import PackageRequest
|
from aurweb.models.package_request import PackageRequest
|
||||||
from aurweb.models.request_type import DELETION_ID, RequestType
|
from aurweb.models.request_type import DELETION_ID, RequestType
|
||||||
from aurweb.models.user import User
|
from aurweb.models.user import User
|
||||||
from aurweb.redis import redis_connection
|
|
||||||
from aurweb.testing.html import parse_root
|
from aurweb.testing.html import parse_root
|
||||||
from aurweb.testing.requests import Request
|
from aurweb.testing.requests import Request
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from aurweb import logging
|
from aurweb import aur_logging
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def test_logging(caplog):
|
def test_logging(caplog):
|
||||||
|
|
|
@ -2,6 +2,7 @@ import pytest
|
||||||
from fastapi.testclient import TestClient
|
from fastapi.testclient import TestClient
|
||||||
|
|
||||||
from aurweb import asgi, config, db, time
|
from aurweb import asgi, config, db, time
|
||||||
|
from aurweb.aur_redis import kill_redis
|
||||||
from aurweb.models.account_type import USER_ID
|
from aurweb.models.account_type import USER_ID
|
||||||
from aurweb.models.official_provider import OFFICIAL_BASE, OfficialProvider
|
from aurweb.models.official_provider import OFFICIAL_BASE, OfficialProvider
|
||||||
from aurweb.models.package import Package
|
from aurweb.models.package import Package
|
||||||
|
@ -11,7 +12,6 @@ from aurweb.models.package_source import PackageSource
|
||||||
from aurweb.models.package_vote import PackageVote
|
from aurweb.models.package_vote import PackageVote
|
||||||
from aurweb.models.user import User
|
from aurweb.models.user import User
|
||||||
from aurweb.packages import util
|
from aurweb.packages import util
|
||||||
from aurweb.redis import kill_redis
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
|
|
|
@ -3,13 +3,13 @@ from unittest import mock
|
||||||
import pytest
|
import pytest
|
||||||
from redis.client import Pipeline
|
from redis.client import Pipeline
|
||||||
|
|
||||||
from aurweb import config, db, logging
|
from aurweb import aur_logging, config, db
|
||||||
|
from aurweb.aur_redis import redis_connection
|
||||||
from aurweb.models import ApiRateLimit
|
from aurweb.models import ApiRateLimit
|
||||||
from aurweb.ratelimit import check_ratelimit
|
from aurweb.ratelimit import check_ratelimit
|
||||||
from aurweb.redis import redis_connection
|
|
||||||
from aurweb.testing.requests import Request
|
from aurweb.testing.requests import Request
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
|
|
|
@ -3,11 +3,11 @@ from unittest import mock
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import aurweb.config
|
import aurweb.config
|
||||||
from aurweb.redis import redis_connection
|
from aurweb.aur_redis import redis_connection
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def rediss():
|
def redis():
|
||||||
"""Create a RedisStub."""
|
"""Create a RedisStub."""
|
||||||
|
|
||||||
def mock_get(section, key):
|
def mock_get(section, key):
|
||||||
|
@ -21,20 +21,20 @@ def rediss():
|
||||||
yield redis
|
yield redis
|
||||||
|
|
||||||
|
|
||||||
def test_redis_stub(rediss):
|
def test_redis_stub(redis):
|
||||||
# We don't yet have a test key set.
|
# We don't yet have a test key set.
|
||||||
assert rediss.get("test") is None
|
assert redis.get("test") is None
|
||||||
|
|
||||||
# Set the test key to abc.
|
# Set the test key to abc.
|
||||||
rediss.set("test", "abc")
|
redis.set("test", "abc")
|
||||||
assert rediss.get("test").decode() == "abc"
|
assert redis.get("test").decode() == "abc"
|
||||||
|
|
||||||
# Test expire.
|
# Test expire.
|
||||||
rediss.expire("test", 0)
|
redis.expire("test", 0)
|
||||||
assert rediss.get("test") is None
|
assert redis.get("test") is None
|
||||||
|
|
||||||
# Now, set the test key again and use delete() on it.
|
# Now, set the test key again and use delete() on it.
|
||||||
rediss.set("test", "abc")
|
redis.set("test", "abc")
|
||||||
assert rediss.get("test").decode() == "abc"
|
assert redis.get("test").decode() == "abc"
|
||||||
rediss.delete("test")
|
redis.delete("test")
|
||||||
assert rediss.get("test") is None
|
assert redis.get("test") is None
|
||||||
|
|
|
@ -2,14 +2,14 @@ from unittest import mock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from aurweb import config, db, logging, time
|
from aurweb import aur_logging, config, db, time
|
||||||
from aurweb.models import Package, PackageBase, PackageComment, User
|
from aurweb.models import Package, PackageBase, PackageComment, User
|
||||||
from aurweb.models.account_type import USER_ID
|
from aurweb.models.account_type import USER_ID
|
||||||
from aurweb.scripts import rendercomment
|
from aurweb.scripts import rendercomment
|
||||||
from aurweb.scripts.rendercomment import update_comment_render
|
from aurweb.scripts.rendercomment import update_comment_render
|
||||||
from aurweb.testing.git import GitRepository
|
from aurweb.testing.git import GitRepository
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
aur_location = config.get("options", "aur_location")
|
aur_location = config.get("options", "aur_location")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ from redis.client import Pipeline
|
||||||
import aurweb.models.dependency_type as dt
|
import aurweb.models.dependency_type as dt
|
||||||
import aurweb.models.relation_type as rt
|
import aurweb.models.relation_type as rt
|
||||||
from aurweb import asgi, config, db, rpc, scripts, time
|
from aurweb import asgi, config, db, rpc, scripts, time
|
||||||
|
from aurweb.aur_redis import redis_connection
|
||||||
from aurweb.models.account_type import USER_ID
|
from aurweb.models.account_type import USER_ID
|
||||||
from aurweb.models.dependency_type import DEPENDS_ID
|
from aurweb.models.dependency_type import DEPENDS_ID
|
||||||
from aurweb.models.license import License
|
from aurweb.models.license import License
|
||||||
|
@ -22,7 +23,6 @@ from aurweb.models.package_relation import PackageRelation
|
||||||
from aurweb.models.package_vote import PackageVote
|
from aurweb.models.package_vote import PackageVote
|
||||||
from aurweb.models.relation_type import PROVIDES_ID
|
from aurweb.models.relation_type import PROVIDES_ID
|
||||||
from aurweb.models.user import User
|
from aurweb.models.user import User
|
||||||
from aurweb.redis import redis_connection
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
|
@ -4,14 +4,14 @@ import lxml.etree
|
||||||
import pytest
|
import pytest
|
||||||
from fastapi.testclient import TestClient
|
from fastapi.testclient import TestClient
|
||||||
|
|
||||||
from aurweb import db, logging, time
|
from aurweb import aur_logging, db, time
|
||||||
from aurweb.asgi import app
|
from aurweb.asgi import app
|
||||||
from aurweb.models.account_type import AccountType
|
from aurweb.models.account_type import AccountType
|
||||||
from aurweb.models.package import Package
|
from aurweb.models.package import Package
|
||||||
from aurweb.models.package_base import PackageBase
|
from aurweb.models.package_base import PackageBase
|
||||||
from aurweb.models.user import User
|
from aurweb.models.user import User
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
|
|
Loading…
Add table
Reference in a new issue