Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup Poetry and pytest #29

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/__pycache__/
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repos:
rev: v3.15.0
hooks:
- id: pyupgrade
- repo: https://github.com/psf/black
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.11.0
hooks:
- id: black
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ COPY scripts/ /scripts/

RUN git config --system --add safe.directory /github/workspace

ENTRYPOINT ["/scripts/prepare_release.py"]
ENTRYPOINT ["/prepare_release/prepare_release.py"]
781 changes: 781 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

Empty file added prepare_release/__init__.py
Empty file.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Optional

from git import Repo
from changelog import get_changelog, get_relevant_commits
from prepare_release.changelog import get_changelog, get_relevant_commits
from specfile import Specfile
from specfile.macro_definitions import CommentOutStyle

Expand All @@ -22,6 +22,7 @@ def prepare_release(
prerelease_suffix_pattern: Optional[str] = None,
prerelease_suffix_macro: Optional[str] = None,
):
click.echo("Preparing a new release")
repo = Repo()
repo_name = (
os.getenv("GITHUB_REPOSITORY", "/").split("/")[1] or Path(repo.working_dir).name
Expand Down
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[tool.poetry]
name = "prepare-release"
version = "0.1.0"
description = "Prepare a release with specfiles"
authors = ["SpyTec <[email protected]>"]
license = "MIT License"
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.9"
GitPython = "^3.1.40"
specfile = "^0.26.0"
click = "^8.1.7"
pytest = "^7.4.4"
ogr = "^0.48.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
9 changes: 9 additions & 0 deletions tests/test_prepare_release.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from click.testing import CliRunner

from prepare_release.prepare_release import prepare_release


def test_prepare_release():
runner = CliRunner()
result = runner.invoke(prepare_release, ["1.1", "."])
assert "Preparing a new release" in result.output