Skip to content

Commit

Permalink
Fixing some ruff warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
le717 committed Jun 8, 2024
1 parent 6b190bb commit db5972f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion get-requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def filter_packages(packages: list, key: str) -> list:
all_packages += filter_packages(poetry_lock["package"], "dev")

# Open the requirements file for writing
with open("requirements.txt", "w") as f:
with Path("requirements.txt").open("w") as f:
# Write all the requested packages
for package in all_packages:
f.write(f"{get_package(package)}\n")
3 changes: 1 addition & 2 deletions src/core/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@

def _linkrot_formatter(record: logging.LogRecord) -> str:
msg_date = datetime.fromtimestamp(record.created).strftime("%B %d, %Y @ %I:%M:%S %p")
msg = f""":warning: Webring Alert :warning:
return f""":warning: Webring Alert :warning:
Alert level: **{record.levelname.capitalize()}**
Date: {msg_date}
Webring URL: {request.root_url}
Link ID: `{record.msg["id"]}`
Link URL: {record.msg["url"]}
Message: {record.msg["message"]}"""
return msg


class DiscordHandler(logging.Handler):
Expand Down
9 changes: 5 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import os
from pathlib import Path

import pytest

os.environ["SYS_VARS_PATH"] = f"{os.getcwd()}/tests/secrets"
os.environ["SYS_VARS_PATH"] = (Path.cwd() / "tests" / "secrets").as_posix()

from src.app_factory import create_app
from src.core.database.schema import db
Expand All @@ -17,15 +18,15 @@ def app():
os.environ["SECRET_KEY"] = "testing-secret-key"
os.environ["TIMES_FAILED_THRESHOLD"] = "3"
os.environ["ENABLE_DISCORD_LOGGING"] = "false"
os.makedirs("tests/db", exist_ok=True)
Path("tests/db").mkdir(parents=True, exist_ok=True)

app = create_app()
yield app

with app.app_context():
db.drop_all()
os.unlink(os.environ["DB_PATH"])
os.rmdir("tests/db")
Path(os.environ["DB_PATH"]).unlink()
Path("tests/db").rmdir()


@pytest.fixture
Expand Down

0 comments on commit db5972f

Please sign in to comment.