From b25cc134a88e1e7119af86d78be8409c8a0d14a9 Mon Sep 17 00:00:00 2001 From: Thephaseless Date: Mon, 21 Oct 2024 13:46:26 +0000 Subject: [PATCH] add logger even if passing --- main.py | 2 +- pyproject.toml | 3 +++ tests/main_test.py | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 84f5535..7ad2015 100644 --- a/main.py +++ b/main.py @@ -60,7 +60,7 @@ async def read_item(request: LinkRequest): browser.stop() except Exception as e: browser.stop() - raise HTTPException(detail="Couldn't bypass", status_code=408) from e + raise HTTPException(detail="Couldn't bypass", status_code=500) from e logger.info(f"Got webpage: {request.url}") diff --git a/pyproject.toml b/pyproject.toml index 96a7788..a76493a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,5 +49,8 @@ ignore = [ select = ["ALL"] extend-safe-fixes = ["D415"] +[tool.pytest] +log_cli = "True" + [tool.pytest.ini_options] asyncio_default_fixture_loop_scope = "function" diff --git a/tests/main_test.py b/tests/main_test.py index 2ad401a..748aa30 100644 --- a/tests/main_test.py +++ b/tests/main_test.py @@ -7,6 +7,7 @@ from starlette.testclient import TestClient from main import app from src.models.requests import LinkRequest +from src.utils import logger client = TestClient(app) @@ -16,7 +17,7 @@ test_websites = [ "https://extratorrent.st/", # github is blocking these "https://idope.se/", # github is blocking these "https://www.ygg.re/", - "https://speed.cd/browse/freeleech", + "https://speed.cd/", ] @@ -27,6 +28,7 @@ def test_bypass(website: str): website, ) if test_request.status_code != HTTPStatus.OK: + logger.info(f"Skipping {website} due to {test_request.status_code}") pytest.skip() response = client.post(