Skip to content
Merged
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
4 changes: 4 additions & 0 deletions doc/changes/changes_7.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ of `main` and the transitive dependencies of `main`.
* #800: Removed tbx security pretty-print, tbx lint pretty-print, and creation of .lint.txt, as superseded by Sonar and .lint.json usage
* #791: Resolved Sonar concerns: accepted specific `subprocess` import usage, `subprocess` commands, & improved minor maintainability items
* #629: Replace `version.py` with version from the `__init__.py`

## Bug Fix

* #808: Resolved `release:prepare` to update `pyproject.toml`
2 changes: 1 addition & 1 deletion exasol/toolbox/util/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def from_poetry():
@poetry_command
def upgrade_version_from_poetry(t: ReleaseTypes):
output = subprocess.run( # nosec: B603, B607 - allow fixed poetry command
["poetry", "version", str(t), "--dry-run", "--no-ansi", "--short"],
["poetry", "version", str(t), "--no-ansi", "--short"],
capture_output=True,
text=True,
)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "exasol-toolbox"
version = "6.4.0"
version = "7.0.0"
description = "Your one-stop solution for managing all standard tasks and core workflows of your Python project."
authors = [
{ name = "Nicola Coretti", email = "nicola.coretti@exasol.com" },
Expand Down
9 changes: 8 additions & 1 deletion test/integration/project-template/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@ def poetry_install(run_command, poetry_path):
# released PTB version with the current checked-out branch in
# PROJECT_CONFIG.root_path:
run_command(
[poetry_path, "add", "--group", "dev", "--editable", PROJECT_CONFIG.root_path]
[
poetry_path,
"add",
"--group",
"dev",
"--editable",
str(PROJECT_CONFIG.root_path),
]
)
# This is needed due to pysonar hard-pinning requests. Without this addition,
# the selected requests has an active vulnerability.
Expand Down
9 changes: 8 additions & 1 deletion test/integration/project-template/nox_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from exasol.toolbox.util.version import Version


class TestSpecificNoxTasks:
"""
Within the PTB, we have nox tasks that are inherently dependent upon other ones
Expand Down Expand Up @@ -58,7 +61,10 @@ def test_package_check(self, poetry_path, run_command):

assert output.returncode == 0

def test_release_prepare(self, poetry_path, run_command):
def test_release_prepare(self, poetry_path, run_command, new_project, monkeypatch):
monkeypatch.chdir(new_project)
assert Version.from_poetry() == Version(0, 1, 0)

release_prepare = self._command(
poetry_path,
task="release:prepare",
Expand All @@ -67,6 +73,7 @@ def test_release_prepare(self, poetry_path, run_command):
output = run_command(release_prepare)

assert output.returncode == 0
assert Version.from_poetry() == Version(0, 2, 0)

def test_install_github_workflows(self, poetry_path, run_command):
install_workflows = self._command(
Expand Down
13 changes: 13 additions & 0 deletions test/unit/util/version_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from exasol.toolbox.error import ToolboxError
from exasol.toolbox.util.version import (
ReleaseTypes,
Version,
poetry_command,
)
Expand Down Expand Up @@ -67,6 +68,18 @@ def test_version_from_poetry(poetry_version, version, expected):
assert expected == actual


def test_upgrade_version_from_poetry_applies_version_change(tmp_path, monkeypatch):
(tmp_path / "pyproject.toml").write_text(
'[project]\nname = "sample-project"\nversion = "0.1.0"\n'
)
monkeypatch.chdir(tmp_path)
assert Version.from_poetry() == Version(0, 1, 0)

actual = Version.upgrade_version_from_poetry(ReleaseTypes.Minor)

assert actual == Version(0, 2, 0)


@patch("exasol.toolbox.util.version.which", return_value=None)
def test_poetry_decorator_no_poetry_executable(mock):
@poetry_command
Expand Down
Loading