Skip to content

Commit 933ca6a

Browse files
committed
Fixed formatting
1 parent 59114de commit 933ca6a

File tree

2 files changed

+88
-22
lines changed

2 files changed

+88
-22
lines changed

exasol/toolbox/nox/_release.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import nox
99
from nox import Session
1010

11+
import noxconfig
1112
from exasol.toolbox.nox._shared import (
1213
Mode,
1314
_version,
@@ -19,7 +20,6 @@
1920
ReleaseTypes,
2021
Version,
2122
)
22-
import noxconfig
2323

2424

2525
def _create_parser() -> argparse.ArgumentParser:
@@ -147,7 +147,9 @@ def prepare_release(session: Session) -> None:
147147
noxconfig.PROJECT_CONFIG.root / "pyproject.toml",
148148
noxconfig.PROJECT_CONFIG.version_file,
149149
]
150-
results = pm.hook.prepare_release_add_files(session=session, config=noxconfig.PROJECT_CONFIG)
150+
results = pm.hook.prepare_release_add_files(
151+
session=session, config=noxconfig.PROJECT_CONFIG
152+
)
151153
changed_files += [f for plugin_response in results for f in plugin_response]
152154
_add_files_to_index(
153155
session,

test/unit/release_test.py

Lines changed: 84 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
from subprocess import CalledProcessError
22
from unittest.mock import (
33
MagicMock,
4-
patch, call,
4+
call,
5+
patch,
56
)
67

78
import pytest
89

10+
import noxconfig
911
from exasol.toolbox.nox._release import (
1012
ReleaseError,
1113
_trigger_release,
1214
)
1315
from exasol.toolbox.util.version import Version
14-
import noxconfig
1516

1617

1718
@pytest.fixture(scope="class")
1819
def mock_from_poetry():
1920
with patch(
20-
"exasol.toolbox.nox._release.Version.from_poetry", return_value=Version(major=0,minor=3,patch=0)
21+
"exasol.toolbox.nox._release.Version.from_poetry",
22+
return_value=Version(major=0, minor=3, patch=0),
2123
) as mock_obj:
2224
yield mock_obj
2325

@@ -42,28 +44,64 @@ def simulate_pass(args, **kwargs):
4244
result = _trigger_release()
4345
assert result == mock_from_poetry.return_value
4446

45-
4647
def test_creates_major_version_tag(self, mock_from_poetry):
4748
def simulate_pass(args, **kwargs):
4849
return self._get_subprocess_run_mock(args)
4950

5051
with patch("subprocess.run", side_effect=simulate_pass) as subprocess_mock:
5152
result = _trigger_release()
52-
assert subprocess_mock.mock_calls == [call(('git', 'remote', 'show', 'origin'), capture_output=True, text=True, check=True),
53-
call(('git', 'checkout', 'main'), capture_output=True, text=True, check=True),
54-
call(('git', 'pull'), capture_output=True, text=True, check=True),
55-
call(('git', 'tag', '--list'), capture_output=True, text=True, check=True),
56-
call(('gh', 'release', 'list'), capture_output=True, text=True, check=True),
57-
call(('git', 'tag', '0.3.0'), capture_output=True, text=True, check=True),
58-
call(('git', 'push', 'origin', '0.3.0'), capture_output=True, text=True, check=True),
59-
call(('git', 'tag', '-f', 'v0'), capture_output=True, text=True, check=True),
60-
call(('git', 'push', '-f', 'origin', 'v0'), capture_output=True, text=True, check=True)]
53+
assert subprocess_mock.mock_calls == [
54+
call(
55+
("git", "remote", "show", "origin"),
56+
capture_output=True,
57+
text=True,
58+
check=True,
59+
),
60+
call(
61+
("git", "checkout", "main"),
62+
capture_output=True,
63+
text=True,
64+
check=True,
65+
),
66+
call(("git", "pull"), capture_output=True, text=True, check=True),
67+
call(
68+
("git", "tag", "--list"), capture_output=True, text=True, check=True
69+
),
70+
call(
71+
("gh", "release", "list"),
72+
capture_output=True,
73+
text=True,
74+
check=True,
75+
),
76+
call(
77+
("git", "tag", "0.3.0"), capture_output=True, text=True, check=True
78+
),
79+
call(
80+
("git", "push", "origin", "0.3.0"),
81+
capture_output=True,
82+
text=True,
83+
check=True,
84+
),
85+
call(
86+
("git", "tag", "-f", "v0"),
87+
capture_output=True,
88+
text=True,
89+
check=True,
90+
),
91+
call(
92+
("git", "push", "-f", "origin", "v0"),
93+
capture_output=True,
94+
text=True,
95+
check=True,
96+
),
97+
]
6198
assert result == mock_from_poetry.return_value
6299

63100
@pytest.fixture
64101
def mock_project_config(self, monkeypatch):
65102
class DummyConfig:
66103
pass
104+
67105
monkeypatch.setattr(noxconfig, "PROJECT_CONFIG", DummyConfig())
68106

69107
def test_not_creates_major_version_tag(self, mock_from_poetry, mock_project_config):
@@ -72,13 +110,39 @@ def simulate_pass(args, **kwargs):
72110

73111
with patch("subprocess.run", side_effect=simulate_pass) as subprocess_mock:
74112
result = _trigger_release()
75-
assert subprocess_mock.mock_calls == [call(('git', 'remote', 'show', 'origin'), capture_output=True, text=True, check=True),
76-
call(('git', 'checkout', 'main'), capture_output=True, text=True, check=True),
77-
call(('git', 'pull'), capture_output=True, text=True, check=True),
78-
call(('git', 'tag', '--list'), capture_output=True, text=True, check=True),
79-
call(('gh', 'release', 'list'), capture_output=True, text=True, check=True),
80-
call(('git', 'tag', '0.3.0'), capture_output=True, text=True, check=True),
81-
call(('git', 'push', 'origin', '0.3.0'), capture_output=True, text=True, check=True)]
113+
assert subprocess_mock.mock_calls == [
114+
call(
115+
("git", "remote", "show", "origin"),
116+
capture_output=True,
117+
text=True,
118+
check=True,
119+
),
120+
call(
121+
("git", "checkout", "main"),
122+
capture_output=True,
123+
text=True,
124+
check=True,
125+
),
126+
call(("git", "pull"), capture_output=True, text=True, check=True),
127+
call(
128+
("git", "tag", "--list"), capture_output=True, text=True, check=True
129+
),
130+
call(
131+
("gh", "release", "list"),
132+
capture_output=True,
133+
text=True,
134+
check=True,
135+
),
136+
call(
137+
("git", "tag", "0.3.0"), capture_output=True, text=True, check=True
138+
),
139+
call(
140+
("git", "push", "origin", "0.3.0"),
141+
capture_output=True,
142+
text=True,
143+
check=True,
144+
),
145+
]
82146
assert result == mock_from_poetry.return_value
83147

84148
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)