diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 64b0940..1edd1d5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ fail_fast: false repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.7.4' + rev: 'v0.8.1' hooks: - id: ruff - repo: https://github.com/pre-commit/pre-commit-hooks diff --git a/trolldb/errors/errors.py b/trolldb/errors/errors.py index 6142ab4..a14b774 100644 --- a/trolldb/errors/errors.py +++ b/trolldb/errors/errors.py @@ -4,8 +4,8 @@ specifically. See :obj:`trolldb.database.errors` as an example on how to achieve this. """ +import sys from collections import OrderedDict -from sys import exit from typing import ClassVar, NoReturn, Self from fastapi import Response @@ -226,7 +226,7 @@ def sys_exit_log( """ _, msg = self.get_error_details(extra_information, status_code) logger.error(msg) - exit(exit_code) + sys.exit(exit_code) @property def fastapi_descriptor(self) -> dict[StatusCode, dict[str, str]]: diff --git a/trolldb/tests/tests_database/test_mongodb.py b/trolldb/tests/tests_database/test_mongodb.py index d077a2e..d9473c1 100644 --- a/trolldb/tests/tests_database/test_mongodb.py +++ b/trolldb/tests/tests_database/test_mongodb.py @@ -12,7 +12,7 @@ import pytest from bson import ObjectId -from pydantic import AnyUrl, ValidationError +from pydantic import MongoDsn, ValidationError from trolldb.database.errors import Client, Collections, Databases from trolldb.database.mongodb import DatabaseConfig, MongoDB, get_id, get_ids, mongodb_context @@ -23,7 +23,7 @@ async def test_connection_timeout_negative(check_log): """Tests that the connection attempt times out after the expected time, since the MongoDB URL is invalid.""" invalid_config = DatabaseConfig( - url=AnyUrl("mongodb://invalid_url_that_does_not_exist:8000"), + url=MongoDsn("mongodb://invalid_url_that_does_not_exist:8000"), timeout=3, main_database_name=test_app_config.database.main_database_name, main_collection_name=test_app_config.database.main_collection_name,