Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1cf8cdb
✨ chore: Update README and GitHub Actions for pytest coverage reporting
depocoder Sep 6, 2025
5b1bc5b
✨ chore: Fix indentation in GitHub Actions workflow for README update…
depocoder Sep 6, 2025
e1c7711
docs: update coverage badge
depocoder Sep 6, 2025
80c864e
✨ chore: Update GitHub Actions workflow and .gitignore for pytest cov…
depocoder Sep 6, 2025
f7d3308
✨ chore: Update README and GitHub Actions for pytest coverage paths
depocoder Sep 6, 2025
32405c9
docs: update coverage badge
depocoder Sep 6, 2025
1c94374
✨ chore: Update GitHub Actions to use pytest-coverage-comment action
depocoder Sep 6, 2025
e228575
✨ chore: Update GitHub Actions workflow for pytest coverage reporting
depocoder Sep 6, 2025
9116483
✨ chore: Add coverage step ID in GitHub Actions workflow
depocoder Sep 6, 2025
cd2c5a1
docs: update coverage badge
depocoder Sep 6, 2025
3e5d3c8
✨ chore: Update README and backend README for pytest coverage reporting
depocoder Sep 6, 2025
054c08b
✨ chore: Enhance pytest coverage reporting in GitHub Actions workflow
depocoder Sep 6, 2025
1fb4519
Revert "✨ chore: Enhance pytest coverage reporting in GitHub Actions …
depocoder Sep 6, 2025
e2ba9b1
✨ chore: Refactor GitHub Actions workflow for pytest execution
depocoder Sep 6, 2025
e11ab2d
✨ chore: Update file pattern for coverage badge in GitHub Actions wor…
depocoder Sep 6, 2025
6ad28d7
docs: update coverage badge
depocoder Sep 6, 2025
db638aa
✨ chore: Add coverage path prefix in GitHub Actions workflow
depocoder Sep 6, 2025
c6577e9
docs: update coverage badge
depocoder Sep 6, 2025
357d46f
✨ chore: Fix coverage path prefix in GitHub Actions workflow
depocoder Sep 6, 2025
e59b356
docs: update coverage badge
depocoder Sep 6, 2025
1f5da20
feat: refactor linters & run configs
depocoder Oct 2, 2025
898c07d
feat: linter code
depocoder Oct 5, 2025
663429b
feat: change debugpy config
depocoder Oct 5, 2025
83ea7d8
feat: delete useless files
depocoder Oct 5, 2025
3eb1fa2
refactor: refactor mts tests name
depocoder Oct 5, 2025
8b14b66
feat: update mypy dep, config
depocoder Oct 5, 2025
00c5bfc
feat: bump version of project
depocoder Oct 5, 2025
4e15d00
fix: fix conflicts
depocoder Oct 6, 2025
26e5e04
feat: refactor lms tests, conftest and handlers
depocoder Oct 5, 2025
24a3481
refactor: handlers.py
depocoder Oct 6, 2025
21303bf
Merge branch 'main' into feature/test_pytest_coverage
depocoder Oct 6, 2025
7a8c217
feat: add new route for lms
depocoder Oct 6, 2025
279541b
feat: add few tests for bulk
depocoder Oct 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions .github/workflows/lint-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,29 @@ jobs:
uv run mypy --config-file=pyproject.toml yet_another_calendar

- name: Run tests
working-directory: backend
run: |
cd backend
YET_ANOTHER_CALENDAR_TUTOR_SECRET_KEY='test' uv run pytest --cov-fail-under=80 --cov=yet_another_calendar/web yet_another_calendar/tests/*
YET_ANOTHER_CALENDAR_TUTOR_SECRET_KEY='test' \
uv run pytest --junitxml=../pytest.xml \
--cov-report=term-missing:skip-covered \
--cov-fail-under=80 \
--cov=yet_another_calendar/web \
yet_another_calendar/tests/* | tee ../pytest-coverage.txt

- name: Pytest coverage comment
id: coverage
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml
coverage-path-prefix: backend/

# - name: Update README
# run: |
# sed -i '/<!-- Pytest Coverage Comment:Begin -->/,/<!-- Pytest Coverage Comment:End -->/c\<!-- Pytest Coverage Comment:Begin -->\n${{ steps.coverage.outputs.coverageHtml }}\n<!-- Pytest Coverage Comment:End -->' ./backend/README.md

# - name: Commit changes
# uses: stefanzweifel/git-auto-commit-action@v5
# with:
# commit_message: 'docs: update coverage badge'
# file_pattern: backend/README.md
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
pytest-coverage.txt
pytest.xml

.idea
.version

Expand Down
7 changes: 4 additions & 3 deletions .vscode/launch.json
100644 β†’ 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
"request": "launch",
"module": "pytest",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}/backend",
"args": [
"backend/yet_another_calendar/tests/"
],
"yet_another_calendar/tests/test_lms.py"
]
},
{
"name": "Python debug backend (docker)",
"request": "attach",
"type": "python",
"type": "debugpy",
"pathMappings": [
{
"localRoot": "${workspaceFolder}/backend",
Expand Down
14 changes: 14 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"python.testing.pytestArgs": [
"./backend/yet_another_calendar/tests/"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,

"ruff.configuration": "./backend/pyproject.toml",
"ruff.nativeServer": "on",

"mypy.dmypyExecutable": "${workspaceFolder}/backend/.venv/bin/dmypy",
"mypy.mypyExecutable": "${workspaceFolder}/backend/.venv/bin/mypy",
"mypy.configFile": "backend/pyproject.toml",
}
6 changes: 0 additions & 6 deletions backend/.flake8

This file was deleted.

1 change: 1 addition & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)


[![Redis](https://img.shields.io/badge/redis-%23DD0031.svg?style=for-the-badge&logo=redis&logoColor=white&style=flat)](https://redis.io/)
[![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white&style=flat)](https://www.docker.com/)
[![FastAPI](https://img.shields.io/badge/FastAPI-005571?style=for-the-badge&logo=fastapi&style=flat)](https://fastapi.tiangolo.com/)
Expand Down
14 changes: 7 additions & 7 deletions backend/generate_password_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,34 @@ def generate_password_hash(password: str | None = None) -> str:
if password is None:
password = getpass.getpass("Enter tutor password: ")
confirm_password = getpass.getpass("Confirm password: ")

if password != confirm_password:
logger.info("Passwords don't match. Please try again.")
return generate_password_hash()

if len(password) < 8:
logger.info("Password must be at least 8 characters long. Please try again.")
if password is None:
return generate_password_hash()
else:
sys.exit(1)

# Generate salt and hash
salt = bcrypt.gensalt()
password_hash = bcrypt.hashpw(password.encode('utf-8'), salt)

return password_hash.decode('utf-8')


if __name__ == "__main__":
password_arg = sys.argv[1] if len(sys.argv) > 1 else None
hash_value = generate_password_hash(password_arg)

# Verify the hash works
if password_arg:
verification_result = bcrypt.checkpw(password_arg.encode('utf-8'), hash_value.encode('utf-8'))
logger.info(f"Hash verification: {verification_result}")

logger.info("\n" + "="*50)
logger.info("Generated password hash:")
logger.info(hash_value)
Expand All @@ -57,4 +57,4 @@ def generate_password_hash(password: str | None = None) -> str:
logger.info("\nFor Docker Compose (escape $ characters):")
docker_hash = hash_value.replace("$", "$$")
logger.info(f"YET_ANOTHER_CALENDAR_TUTOR_PASSWORD_HASH={docker_hash}")
logger.info("="*50)
logger.info("="*50)
25 changes: 18 additions & 7 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "yet_another_calendar"
version = "2.0.0"
version = "2.1.0"
description = ""
authors = [
{ name = "Ivan Popov", email = "ma1n.py@yandex.ru" },
Expand All @@ -14,6 +14,7 @@ dependencies = [
"environs>=14.1.1",
"fastapi>=0.115.11",
"fastapi-cache2>=0.2.2",
"flake8-import-conventions>=0.1.0",
"httpx[http2]==0.27.2",
"icalendar>=6.1.1",
"loguru>=0.7.3",
Expand All @@ -36,7 +37,8 @@ dependencies = [
dev = [
"black>=25.1.0",
"fakeredis>=2.27.0",
"mypy>=1.15.0",
"flake8-async>=25.7.1",
"mypy>=1.18.2",
"pytest>=8.3.5",
"pytest-asyncio>=0.25.3",
"pytest-cov>=6.0.0",
Expand Down Expand Up @@ -72,14 +74,15 @@ env = [
"YET_ANOTHER_CALENDAR_DB_BASE=yet_another_calendar_test",
]

[ruff]
[tool.ruff]
target-version = "py311"

lint.select = [
"A", # prevent using keywords that clobber python builtins
"N", # pep8-naming
"B", # bugbear: security warnings
"E", # pycodestyle
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"ISC", # implicit string concatenation
"UP", # alert you when better syntax is available in your python version
Expand All @@ -91,7 +94,15 @@ lint.select = [
"COM", # flake8-logging
"ASYNC", # flake8-async
"ANN", # flake8-annotations
"C4", # flake8-comprehensions
"EXE", # flake8-executable
"FIX", # flake8-fixme
"ICN", # flake8-import-conventions
"PIE", # flake8-pie

"PL", # Pylint
"PLE", # pylint errors

]
lint.ignore = [
"ANN401",
Expand All @@ -102,14 +113,14 @@ lint.ignore = [
line-length = 119
exclude = [
".venv/",
"yet_another_calendar/tests/*",
"*/tests/*",
]

[ruff.lint.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "pep257"
ignore-decorators = ["typing.overload"]

[ruff.lint.pylint]
[tool.ruff.lint.pylint]
allow-magic-value-types = ["int", "str", "float", "bytes"]

[fastapi-template.options]
Expand Down
Loading