From f2e6f0b20bf767765c58d2da4ac61bc93b46ee68 Mon Sep 17 00:00:00 2001 From: sebthom Date: Mon, 12 May 2025 14:08:50 +0200 Subject: [PATCH] chore: update pyproject.toml --- .github/workflows/build.yml | 6 +++--- README.md | 7 ++++--- pyproject.toml | 9 ++++++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5d05842..f5fe355 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -153,7 +153,7 @@ jobs: - name: Run unit tests - run: pdm run utest + run: pdm run utest:cov --cov=src/kleinanzeigen_bot - name: Run integration tests @@ -163,9 +163,9 @@ jobs: case "${{ matrix.os }}" in ubuntu-*) sudo apt-get install --no-install-recommends -y xvfb - xvfb-run pdm run itest + xvfb-run pdm run itest:cov ;; - *) pdm run itest + *) pdm run itest:cov ;; esac diff --git a/README.md b/README.md index 87f1818..6de4def 100644 --- a/README.md +++ b/README.md @@ -420,10 +420,11 @@ By default a new browser process will be launched. To reuse a manually launched - Format source code: `pdm run format` - Run tests: - - unit tests: `pdm run utest` - - integration tests: `pdm run itest` - - all tests: `pdm run test` + - unit tests: `pdm run utest` - with coverage: `pdm run utest:cov` + - integration tests: `pdm run itest` - with coverage: `pdm run itest:cov` + - all tests: `pdm run test` - with coverage: `pdm run test:cov` - Run syntax checks: `pdm run lint` +- Linting issues found by ruff can be auto-fixed using `pdm run lint:fix` - Create platform-specific executable: `pdm run compile` - Application bootstrap works like this: ```python diff --git a/pyproject.toml b/pyproject.toml index 7a272ee..277de14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,6 +70,7 @@ Homepage = "https://github.com/Second-Hand-Friends/kleinanzeigen-bot" Repository = "https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git" Documentation = "https://github.com/Second-Hand-Friends/kleinanzeigen-bot/README.md" Issues = "https://github.com/Second-Hand-Friends/kleinanzeigen-bot/issues" +CI = "https://github.com/Second-Hand-Friends/kleinanzeigen-bot/actions" ##################### @@ -85,9 +86,12 @@ write_template = "__version__ = '{}'\n" app = "python -m kleinanzeigen_bot" debug = "python -m pdb -m kleinanzeigen_bot" +# build & packaging +generate-schemas = "python scripts/generate_schemas.py" compile.cmd = "python -O -m PyInstaller pyinstaller.spec --clean" compile.env = {PYTHONHASHSEED = "1", SOURCE_DATE_EPOCH = "0"} # https://pyinstaller.org/en/stable/advanced-topics.html#creating-a-reproducible-build +# format & lint format = { composite = ["format:py", "format:yaml"] } "format:py" = { shell = "autopep8 --recursive --in-place scripts src tests --verbose && python scripts/post_autopep8.py scripts src tests" } "format:yaml" = "yamlfix scripts/ src/ tests/" @@ -98,9 +102,13 @@ lint = { composite = ["lint:ruff", "lint:mypy", "lint:pyright"] } "lint:pyright" = "basedpyright" "lint:fix" = {shell = "ruff check --preview --fix" } +# tests test = "python -m pytest --capture=tee-sys -v" utest = "python -m pytest --capture=tee-sys -v -m 'not itest'" itest = "python -m pytest --capture=tee-sys -v -m 'itest'" +"test:cov" = { composite = ["test --cov=src/kleinanzeigen_bot"] } +"utest:cov" = { composite = ["utest --cov=src/kleinanzeigen_bot"] } +"itest:cov" = { composite = ["itest --cov=src/kleinanzeigen_bot"] } ##################### @@ -303,7 +311,6 @@ addopts = """ --strict-markers -p no:cacheprovider --doctest-modules - --cov=src/kleinanzeigen_bot --cov-report=term-missing """ markers = [