Skip to content

Commit d00fb6a

Browse files
committed
Switch create_major_version_tags to also be required to encourage BaseConfig
1 parent 041b51a commit d00fb6a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

exasol/toolbox/nox/_release.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from exasol.toolbox.nox._shared import (
1212
Mode,
1313
_version,
14+
check_for_config_attribute,
1415
)
1516
from exasol.toolbox.nox.plugin import NoxTasks
1617
from exasol.toolbox.util.git import Git
@@ -101,10 +102,8 @@ def run(*args: str):
101102
run("git", "tag", str(release_version))
102103
run("git", "push", "origin", str(release_version))
103104

104-
if (
105-
hasattr(project_config, "create_major_version_tags")
106-
and project_config.create_major_version_tags
107-
):
105+
check_for_config_attribute(project_config, "create_major_version_tags")
106+
if project_config.create_major_version_tags:
108107
major_release_version = f"v{release_version.major}"
109108
run("git", "tag", "-f", str(major_release_version))
110109
run("git", "push", "-f", "origin", str(major_release_version))

test/unit/release_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import pytest
99

1010
import noxconfig
11+
from exasol.toolbox.config import BaseConfig
1112
from exasol.toolbox.nox._release import (
1213
ReleaseError,
1314
_trigger_release,
@@ -65,14 +66,14 @@ def simulate_pass(args, **kwargs):
6566
assert result == mock_from_poetry.return_value
6667

6768
def test_not_creates_major_version_tag(self, mock_from_poetry):
68-
class DummyConfig:
69+
class DummyConfig(BaseConfig):
6970
pass
7071

7172
def simulate_pass(args, **kwargs):
7273
return self._get_subprocess_run_mock(args)
7374

7475
with patch("subprocess.run", side_effect=simulate_pass) as subprocess_mock:
75-
result = _trigger_release(DummyConfig)
76+
result = _trigger_release(DummyConfig())
7677
commands = [c.args[0] for c in subprocess_mock.mock_calls]
7778
assert commands == [
7879
("git", "remote", "show", "origin"),

0 commit comments

Comments
 (0)